我有一个组合框,根据另一个组合框的选择填充其值.我已经看到了基于选择更改底层存储中的参数的示例,但我想要实现的是根据第一个组合的选择更改第二个组合的存储本身.这是我的代码,但它不起作用.有人可以帮忙吗?
{
xtype: 'combo',
id: 'leads_filter_by',
width: 100,
mode: 'local',
store: ['Status','Source'],
//typeAhead: true,
triggerAction: 'all',
selectOnFocus:true,
typeAhead: false,
editable: false,
value:'Status',
listeners:{
'select': function(combo,value,index){
var filter_to_select = Ext.getCmp('cmbLeadsFilter');
var container = filter_to_select.container;
if (index == 0){
filter_to_select.store=leadStatusStore;
filter_to_select.displayField='leadStatusName';
filter_to_select.valueField='leadStatusId';
} else if(index==1) {
filter_to_select.store=leadSourceStore;
filter_to_select.displayField='leadSourceName';
filter_to_select.valueField='leadSourceId';
}
}
}
},
{
xtype: 'combo',
id: 'cmbLeadsFilter',
width:100,
store: leadStatusStore,
displayField: 'leadStatusName',
valueField: 'leadStatusId',
mode: 'local',
triggerAction: 'all',
selectOnFocus:true,
typeAhead: false,
editable: false
},
Run Code Online (Sandbox Code Playgroud) 我有一个自定义数据存储,它存储商店是否已加载一次的信息.
/**
* Custom DataStore which stores the information whether data has been loaded once or not.
*/
Ext.example.Store = Ext.extend(Ext.data.Store, {
loaded: false,
initComponent: function() {
this.superclass().initComponent.call(this);
this.addEvents('load','beforeload');
},
isLoaded : function() {
return this.loaded;
},
listeners: {
'load' : function(store,records,options) {
this.loaded = true;
}
}
});
Run Code Online (Sandbox Code Playgroud)
这工作正常,直到最近我添加了一个'beforeload'事件监听器到这个商店的实例.现在不会调用'load'侦听器.
var accountsDataStore = new Ext.example.Store({
id : 'account',
proxy : new Ext.data.HttpProxy({
url : 'app/account/fetch/all',
method : 'post',
api : {
destroy : 'app/account/delete'
}
}),
reader : accountReader,
writer …
Run Code Online (Sandbox Code Playgroud) 我知道ExtJS使用AJAX进行所有服务器端通信,理想情况下每个应用程序只有一个页面.但我正在探索为ExtJS选项卡生成唯一URL的可能性,然后用户可以从地址栏复制以供以后使用(传统的Web应用程序方法 - 使页面可收藏).如果有人做过类似的事情,请告诉我.
在提交编辑详细信息表单之前,我正在进行脏检查.这在表单加载后第一次工作,但如果我提交表单一次,脏检查将停止在后续调用中工作.
if(editForm.getForm().isDirty()) {
editForm.getForm().submit( {
url:'app/update',
waitMsg:'Saving data',
success:function(form,action) {
Ext.Msg.alert("Success", "Successfully updated");
},
failure: function(form,action) {
Ext.Msg.alert("Failure", "Failed to update");
}
});
} else {
Ext.Msg.alert("Message", "Nothing has been changed since you last saved.");
}
Run Code Online (Sandbox Code Playgroud) extjs ×4