PDA

View Full Version : HtmlEditor getToolbar().addButton [OK] getToolBar().insertButton [FAIL]



DaviBaldin
24 Sep 2009, 10:52 AM
Hi all,

I need to add a new button into the HtmlEditor toolbar at the first position. However when I tried to add by insertButton() I've got the error:

this.cmp.getToolBar is not a function

This is the full source code:


App.ToolBarSaveComments = Ext.extend(Ext.util.Observable, {
// private
init: function(cmp) {
this.cmp = cmp;
this.cmp.on('render', this.onRender, this);
},
// private
onRender: function() {
// this.cmp.getToolbar().addButton([new Ext.Toolbar.Separator(), new Ext.Button({
// text: 'Save/Update',
// iconCls: 'save',
// handler: function (b,e) {
// alert('update...');
// }
// })]);
this.cmp.getToolBar().insertButton(0, [new Ext.Button({
text: 'Save/Update',
iconCls: 'save',
handler: function (b,e) {
alert('update...');
}
}), new Ext.Toolbar.Separator()]
);
}
});

The code usage is:


{
xtype:'htmleditor',
autoScroll: true,
id: 'ticketCommentsField',
plugins: [new App.ToolBarSaveComments()]
}


What I'm doing wrong??????

Thanks all,

Davi.