古詩詞大全網 - 古詩大全 - extjs中在GridPanel上添加壹個搜索框 (文本框+按鈕)怎麽實現啊。。

extjs中在GridPanel上添加壹個搜索框 (文本框+按鈕)怎麽實現啊。。

直接配置到工具條tbar裏就行了:

var grid = new Ext.grid.GridPanel({

id: "grid1",

title: "GridPanel實例",

renderTo: "div1",

width: 500,

height: 300,

frame: true,

tbar: [{xtype:'label',text:'請輸入關鍵詞:'},{xtype:'textfield',id:'KeyWord'},{text:'搜索',handler:function(){alert("搜索");}}

],

。。。。。//其它配置項

});