PDA

View Full Version : How to remove a tool bar button dynamicaly,



samith143
27 Apr 2009, 4:09 AM
following is my tool bar in data grid,i want to remove the Add button according to user logged,how can i achieve this? please help...


items: {
xtype: 'grid',
id:'asset-grid',
tbar:[{
text:'Add Asset',
id:'butAdd',
tooltip:'Add a new Asset',
iconCls:'add',
handler: function(){}
}, '-', {
text:'Edit Asset',
tooltip:'Edit the selected Asset',
iconCls:'option',
handler: function(){}
}
},'-',{
text:'Delete Asset',
tooltip:'Remove the selected Asset',
iconCls:'remove',
handler: function(){}
} // end of handler
}], //end of tbar
height:290,
viewConfig: {
forceFit:true,
enableRowBody:true,
showPreview:true,
emptyText: 'No records to display.',
getRowClass : this.applyRowClass
},
store: ds,
cm: cmPartCatList,
sm: sm,
loadMask:true,
trackMouseOver:true,
stripeRows: true
}

27 Apr 2009, 4:19 AM
1) we have a help section, have you seen it?
2) Please post code in code tags
3) It all depends on HOW you code your applications. Look at the api, the toolbar now extends container, which means it has add/remove

prometheus
27 Apr 2009, 6:01 AM
Yep. In Ext 3.0:

...
{
text:'button',
handler:function(self){self.ownerCt.remove(self);}
}