比方有几个查询条件,有一个“查询”按钮,点击按钮后需要按条件刷新一下GRID里的数据,那么在按钮的handler里去写代码就好了,先得到那几个条件控件的值,然后将他们作为参数,调用STORE的LOAD或者RELOAD方法就可以了。
比如:
然后再后台取得request中传递过来的参数searchValue1,searchValue2进行数据库查询就好了。
比如:
var grid = new Ext.grid.GridPanel({
store : testStore,
columns : testCols,
stripeRows : true,
width : 550,
height : 500,
title : '测试表格',
tbar : ['条件1',
{
xtype : 'textfield',
name : 'search1',
id : 'search1'
}, '-','条件2',
{
xtype : 'textfield',
name : 'search2',
id : 'search2'
},
{
text : '查询',
handler : function() {
testStore.load({
params : {
searchValue1 : Ext.getCmp('search1').getValue(),
searchValue2 : Ext.getCmp('search2').getValue()
}
});
},
scope : this
}]
});
然后再后台取得request中传递过来的参数searchValue1,searchValue2进行数据库查询就好了。