View Full Version : Setting a buttin disabled or enabled

10 Sep 2008, 2:00 PM
Hello all,
I have a Panel listing some emails, when the user selects a row, i have to enable a menu, when there's no selections, the menu shall remain disabled, here's my code:

var topBar = [
text: 'Actions',
id: 'actionsMenu',
disabled: true,
menu: [actionMarkAsRead, actionMarkAsUnread, actionDelete]
'Search: ',
' ',
new Ext.app.SearchField({
store: store,
width: 180,
hasSearch: true

var selectModel = new Ext.grid.CheckboxSelectionModel({
listeners: {
selectionchange: function() {
if(selectModel.getCount() > 0) {
Ext.getCmp('actionsMenu').disabled = false;
else {
Ext.getCmp('actionsMenu').disabled = true;

As you can see, i have no idea how to set that set of buttons to disabled and enabled ...
anyone can help me ?

10 Sep 2008, 2:13 PM
Generally when you want to perform an action on a particular object, you should look for methods rather than properties. Button shows it has enable() and disable() methods in the API docs.

10 Sep 2008, 2:22 PM
thank you.
I didnt know it was a Button object since it's a simple array.

10 Sep 2008, 2:36 PM
That's a little confusing because at the end of your prior post you say "button"?

Maybe this is where you needed to look?

Creates a new Toolbar

config : Object/Array
A config object or an array of buttons to add