[code="js"]
items:[{
text: '查询',
handler: function() {}
// 插入到这里
},'-',{
text: '删除',
handler: function() { }
}][/code]
[code="js"]toolbar.insertButton(1, {text:'我是第三者:)'});
[/code]如果是工具栏你可以这样来
你的意思是在toolbar上动态添加按钮?
Toolbar
add( Mixed arg1, Mixed arg2, Mixed etc. ) : void
Adds element(s) to the toolbar -- this function takes a variable number of arguments of mixed type and adds them to the toolbar.
// add a Button
tb.add({
text:'xx'
});
tb.doLayout();
插入按钮的话可以调用tb.add(o)方法,不过应该是要的render后才可以插入,你先试一下tb.add()如果不行的话就用:
[code="java"]
tb.on('render',function(){
tb.add()
})
[/code]
[quote]items:[{
text: '查询',
handler: function() {}
// 插入到这里
},'-',{
text: '删除',
handler: function() { }
}] [/quote]
你这个放到toolbar不是就可以了吗>?
例如:
//的工具栏
this.treeToolBar = new Ext.Toolbar({
//autoHeight:true,
items:[{
tooltip:'新增组',
iconCls:'add',
scope:this,
handler:this.addChildOrgan
}, '-', {
tooltip:'修改组',
iconCls:'edit',
scope:this,
handler:this.modifyGroup
}, '-', {
tooltip:'删除组',
iconCls:'remove',
scope:this,
handler: this.delOrgan
}
]
});