Ext如何给Toolbar添加按钮
Ext.onReady(function() {
var tbar = new Ext.Toolbar({
height: 50,
items: [new Ext.Button({ text: "button here",
handler: function(btn) {
Ext.MessageBox.alert("it's a button here!");
}
})]
});
var p = new Ext.Panel({
tbar: tbar,
renderTo: Ext.getBody()
});
// 如果addButton写在这里就不行
//写在这里是因为上面panel已经初始化了。
//这样写:
p.getTopToolbar().add([{
text: "save"
},
{
text: "close"
}]);
p.doLayout();
});
var tbar = new Ext.Toolbar({
height: 50,
items: [new Ext.Button({ text: "button here",
handler: function(btn) {
Ext.MessageBox.alert("it's a button here!");
}
})]
});
var p = new Ext.Panel({
tbar: tbar,
renderTo: Ext.getBody()
});
// 如果addButton写在这里就不行
//写在这里是因为上面panel已经初始化了。
//这样写:
p.getTopToolbar().add([{
text: "save"
},
{
text: "close"
}]);
p.doLayout();
});
浙公网安备 33010602011771号