刚开始学习Extjs,想实现一个服务端查询。我在我的Extjs MVC的Contriller中写了一些这样的代码:</p>
'SearchPanel button[action=select]': {
'click' : function() {
//console.log(Ext.getDom('s_name').value );
console.log(Ext.getCmp('s_studentid').getValue());
var grid = Ext.ComponentQuery.query('studentList')[0];
var store = grid.store;
store.filterBy(function(record) {
//return record.get('name') == '张新武' && record.get('id') == 8;
var s_studentid = Ext.getCmp('s_studentid').getValue();
var s_name = Ext.getCmp('s_name').getValue();
var s_unikey = Ext.getCmp('s_unikey').getValue();
var s_type = Ext.getCmp('s_type').getValue();
var s_sex = Ext.getCmp('s_sex').getValue();
var s_college = Ext.getCmp('s_college').getValue();
var s_major = Ext.getCmp('s_major').getValue();
var s_ethnic = Ext.getCmp('s_ethnic').getValue();
return (s_studentid == "" || record.get('id') == s_studentid)
&&(s_name == "" || record.get('name').indexOf(s_name)>=0)
&&(s_unikey == "" || record.get('name') == s_unikey)
&&(s_type == "" || record.get('type') == s_type)
&&(s_sex == "" || record.get('sex') == s_sex)
&&(s_college == "" || record.get('college') == s_college)
&&(s_major == "" || record.get('major') == s_major)
&&(s_ethnic == "" || record.get('ethnic') == s_ethnic);
console.log('invoke select');
});
}
}
但我发现它从 Extjs 存储中查询数据,而不是从服务器端查询数据。如何更改我的代码以使其可以从服务器端查询数据。