Reputation: 6416
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.
Upvotes: 3
Views: 20542
Reputation: 5570
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?
Upvotes: 8