[code="js"]
Ext.onReady(function() {
var headToolbar = new Ext.Panel({
renderTo:'dictionary_List_div'
});
headToolbar.add(new Ext.Toolbar({
items:[
{text :"查询",iconCls :'icon-search',handler:function(){}},
{text :"清空条件",iconCls :'icon-edit',handler:function(){}}
]
}));
headToolbar.show();
}
[/code]
页面是
div设置如下:
[code="html"]
[/code]
在ExtJS 4中
[code="js"]
Ext.onReady(function() {
Ext.createWidget('panel', {
renderTo: 'dictionary_List_div',
tbar: [{
text :"查询",iconCls :'icon-search',handler:function(){}
},{
text :"清空条件",iconCls :'icon-edit',handler:function(){}
}]
});
var panel = Ext.createWidget('panel', {
renderTo: 'dictionary_List_div2',
tbar: []
});
panel.getDockedComponent(0).add([{
text :"查询",iconCls :'icon-search',handler:function(){}
},{
text :"清空条件",iconCls :'icon-edit',handler:function(){}
}]);
});
[/code]
试试headToolbar.doLayout()
另外,这里可以不用panel,用Ext.Container就好