extjs - 商店不在 ExtJs 中重新加载
问题描述
我正在处理一个需要绑定组合框但它没有重新加载最新数据的显示器。只有一次调用数据库,然后使用缓存中的现有存储。如何让它每次都从数据库重新加载(或者至少每次我们重新打开显示时)。下面是代码。
//store
Ext.define('NetworkStore', {
extend: 'Ext.data.Store',
alias: 'NetworkStore',
fields: ['Id', 'value'],
storeId: 'NetworkStore',
autoLoad: true,
proxy: {
type: 'ajax',
useDefaultXhrHeader: false,
actionMethods: { create: "POST", read: "GET", update: "POST", destroy: "POST" },
headers: { 'Content-Type': 'application/x-www-form-urlencode' },
limitParam: false,
startParam: false,
pageParam: false,
extraParams: {
Style: 1
},
url: 'url',
reader: {
type: 'json'
}
}
});
xtype: 'combo',
name: 'NetworkIDList',
store: Ext.create('NetworkStore').load({
params: {
Style: 3
}
}),
解决方案
提供的官方文档lastQuery
:
listeners: {
beforequery: function (qe) {
delete qe.combo.lastQuery;
}
}
这是完整的问题:
/**
* @property {String} lastQuery
* The value of the match string used to filter the store. Delete this property to force
* a requery. Example use:
*
* var combo = new Ext.form.field.ComboBox({
* ...
* queryMode: 'remote',
* listeners: {
* // delete the previous query in the beforequery event or set
* // combo.lastQuery = null (this will reload the store the next time it expands)
* beforequery: function(qe){
* delete qe.combo.lastQuery;
* }
* }
* });
*
* To make sure the filter in the store is not cleared the first time the ComboBox trigger
* is used configure the combo with `lastQuery=''`. Example use:
*
* var combo = new Ext.form.field.ComboBox({
* ...
* queryMode: 'local',
* triggerAction: 'all',
* lastQuery: ''
* });
*/
推荐阅读
- python - Django/Pillow ImageField - 图像未显示
- django - Django graphen 创建 Mution 触发错误
- python - 如何创建连接、执行和断开连接的函数
- python - 如何最小化给定数据集的错误
- java - 如何在表格中添加垂直标题?
- java - 如何优雅地关闭 Spring 并使用 HTML 按钮关闭所有 mysql 连接?
- memory - Linux分页:linux如何折叠Page Upper Directory和Page Middle Directory?
- python - 如何在python中使用cec控件
- html - 边距如何随最小高度折叠?
- php - 从一条记录中选择多个值