ExtJs之combox控制grid中的数据显示

this.centergrid = new Ext.grid.GridPanel({
title:'总帐',
autoHeight:true,
cm:new Ext.grid.ColumnModel([{header:'编号',width:50},{header:'',width:60},{header:'',width:60},{header:'凭单号',width:60},{header:'摘要',width:130},{header:'',width:60},{header:'',width:60},{header:'借或贷',width:60},{header:'余额',width:100}]),
store: new Ext.data.Store({
proxy:new Ext.data.HttpProxy({ url : 'doGetData.do'}),
reader:new Ext.data.JsonReader({root:'root'},[{name:'scm'},{name:'month'},{name:'day'},{name:'vchid'},{name:'remark'},{name:'jie'},{name:'dai'},{name:'jord'},{name:'yue'}])
})
},this);
this.centergrid.store.load({params:{isdetail:this.isdetail}},this);

以上是定义一个grid,然后在定义一个combox,在combox的select监听事件中这样写:

 Ext.getCmp('detail').on('select',function(combox){
this.isdetail=combox.getValue();
this.centergrid.getStore().removeAll();
this.centergrid.getStore().load({params:{isdetail:this.isdetail}},this);
},this);

这样就可以在后台接受isdetail参数,来控制前台grid中的数据显示了。

最后附上今天背得唐诗:

《梦李白·其二》 作者:杜甫 

浮云终日行,游子久不至。 

三夜频梦君,情亲见君意。 

告归常局促,苦道来不易。 

江湖多风波,舟楫恐失坠。 

出门搔白首,若负平生志。 

冠盖满京华,斯人独憔悴。 

孰云网恢恢,将老身反累。 

千秋万岁名,寂寞身后事。

 

【韵译】: 悠悠云朵终日飞来飘去, 远方游子为何久久不至。 

一连几夜我频频梦见你, 情亲意切可见对我厚谊。 

每次梦里你都匆匆辞去, 还总说相会可真不容易。 

你说江湖风波多么险恶, 担心船只失事葬身水里。 

出门时你总是搔着白首, 好象是辜负了平生壮志。 

京都的官僚们冠盖相续, 唯你不能显达形容憔悴。 

谁说天网恢恢疏而不漏? 你已年高反被牵连受罪。 

千秋万代定有你的声名, 那是寂寞身亡后的安慰。 

posted on 2011-11-10 21:18  chanya  阅读(4202)  评论(0编辑  收藏  举报

导航