PDA

View Full Version : How to add a button in tool zone



igcristian
22 Mar 2010, 2:33 AM
It's there a solution for adding a button in tool zone in a panel after the panel is rendered?

I want to add this button after the user will log in, but something like myPanel.tools = [{mybutton}] is not working. This code is ok if I'll put it before my panel is rendered.

Thank you,
Cristi

Condor
22 Mar 2010, 2:40 AM
Panel has an 'addTool' method that you can use.

ps. I would use a different approach. Specify all buttons in the tools array, but with hidden:true if they shouldn't be visible.

igcristian
22 Mar 2010, 3:06 AM
Thank you Condor, I didn't know about addTool and it seems this was my solution.
I prefer to use addTool instead hidden:true because, for example, using FireBug someone could see my button very easy.

lingz_public
23 Mar 2010, 1:16 AM
Panel has an 'addTool' method that you can use.

ps. I would use a different approach. Specify all buttons in the tools array, but with hidden:true if they shouldn't be visible.

I encounter same question. I want to add customized icon to tool zone, while the icon won't show up. Could be CSS problems, but not knowing what's wrong:
I define the customized css in html file:


.x-tool-bar {
cursor:pointer;
background:transparent url(./ext-2.3.0/examples/shared/icons/fam/star.png) no-repeat;
}

And in tool array: the item is defined as:

{id:'columnChart',
iconCls:'x-tool-bar',
handler:function(e,t,p){
p.setSourceURL('../FusionCharts/Column2D.swf');
p.refreshMedia();},
qtip: {text:'Column Chart'}
},
Seems iconCls does not work for the tool icons.

I want to get some clues on this. thanks!

igcristian
23 Mar 2010, 1:31 AM
I encounter same question. I want to add customized icon to tool zone, while the icon won't show up. Could be CSS problems, but not knowing what's wrong:
I define the customized css in html file:


.x-tool-bar {
cursor:pointer;
background:transparent url(./ext-2.3.0/examples/shared/icons/fam/star.png) no-repeat;
}

And in tool array: the item is defined as:

{id:'bar',
handler:function(e,t,p){
p.setSourceURL('../FusionCharts/Column2D.swf');
p.refreshMedia();},
qtip: {text:'Column Chart'}
},
Seems iconCls does not work for the tool icons.

I want to get some clues on this. thanks!

For showing the right icon in the tool button, the id of this must be the same with the css you used for it with the prefix '.x-tool-'.
For example, for your css code, you should have:


{id:'bar',
handler:function(e,t,p){
p.setSourceURL('../FusionCharts/Column2D.swf');
p.refreshMedia();},
qtip: {text:'Column Chart'}
},

Read the documentation of tools panel.

lingz_public
23 Mar 2010, 6:16 PM
Thanks igcristian. That works!

I read document for panel tools config, not fully understood. Thanks for explanations.