PDA

View Full Version : Good way to modify existing toolbars



rf_qcomm
28 Jul 2010, 8:37 AM
Is there a good/easy way to modify the toolbar that comes with a component. NestedList, for example, has its own innate toolbar with a back button. Is there a way I can add buttons, text, and such to the same toolbar without ruining the back button's functionality?

gstock
7 Jan 2011, 9:10 AM
I just went into the secha-touch.js and added a button called homeButton
You will have to edit the handler..


initComponent : function() {

var store = Ext.StoreMgr.lookup(this.store),
rootNode = store.getRootNode(),
title = rootNode.getRecord() ? this.renderTitleText(rootNode) : this.title || '';

this.store = store;

if (this.useToolbar) {

this.backButton = new Ext.Button({
text: this.backText,
ui: 'back',
handler: this.onBackTap,
scope: this,

hidden: true
});
this.homeButton=new Ext.Button({text:'Home',ui:"round",handler:this.onBackTap,scope:this,hidden:true});
if (!this.toolbar || !this.toolbar.isComponent) {

this.toolbar = Ext.apply({}, this.toolbar || {}, {
dock: 'top',
xtype: 'toolbar',
ui: 'light',
title: title,
items: []
});
this.toolbar.items.unshift(this.homeButton);
this.toolbar.items.unshift(this.backButton);
this.toolbar = new Ext.Toolbar(this.toolbar);

this.dockedItems = this.dockedItems || [];
this.dockedItems.push(this.toolbar);
} else {
this.toolbar.insert(0, this.backButton);
this.toolbar.insert(1, this.homeButton);
}
}

gstock
7 Jan 2011, 9:20 AM
Actually it looks as if the code does not handle adding more buttons to the nestedlist bar..

I dont see it