Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
149
rated 0 times [  151] [ 2]  / answers: 1 / hits: 20456  / 14 Years ago, mon, march 21, 2011, 12:00:00

I am attempting to show/hide an ExtJS Toolbar button programmatically. I have tried to access the button directly, by ID using:



var btn = Ext.get('buttonID'); // I've also tried Ext.query('buttonID')
btn.show();


However, this does not cause the button to be shown. The toolbar button is defined with the ID with which I am attempting to execute the show() method.



Is there a different way for me to access the button, directly? Or, is there a different way to show it (adding/removing CSS attributes, etc.)?



Thank you in advance.


More From » extjs

 Answers
26

If you want to show a button, which is not visible, then do



// Button definition
var btn = new Ext.Button({
text: 'Press me!',
visible: false,
id: 'myButton'
});

// Now show the button.
var theSameButton = Ext.getCmp('myButton');
btn.setVisible(true);


Is this what you want?


[#93160] Saturday, March 19, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cristinah

Total Points: 268
Total Questions: 113
Total Answers: 89

Location: South Korea
Member since Sat, Oct 2, 2021
3 Years ago
;