0
查询从服务器端数据我刚开始学ExtJS的,并希望实现服务器端query.I已经写了一些像这样的代码中的ExtJS Contriller我的MVC:如何使用Extjs4.1
'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存储中查询数据,而不是从服务器端。如何更改我的代码以便它可以从服务器端查询数据。
用新paramset重装但必须是许多参数,可以如S_NAME,s_unikey,S_TYPE等如何将这些参数传递给服务器端。我是菜鸟,也许这个问题很愚蠢。 – 2012-08-04 13:02:57
查看http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.AbstractStore和http://docs.sencha.com/ext-js/4-0/ #!/ api/Ext.data.Operation – Aadaam 2012-08-04 13:08:49
谢谢you.now我将这些参数传递给服务器端。我的url是这样的:http:// localhost:8080/soft-enroll/student?_dc = 1344085932402&s_studentid = 6&S_NAME =&s_unikey =&S_TYPE =&s_sex =&s_college =&s_major =&s_ethnic =&页= 1&开始= 0&极限= 3。它不是一个宁静的网址。我想要得到这样一个网址:http:// localhost:8080/soft-enroll/student/query.How do I do? – 2012-08-04 13:19:59