Results 1 to 4 of 4

Thread: Setting a buttin disabled or enabled

  1. #1

    Default Setting a buttin disabled or enabled

    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:
    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 ?

  2. #2

    Default

    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.

  3. #3

    Default

    thank you.
    I didnt know it was a Button object since it's a simple array.

  4. #4
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    That's a little confusing because at the end of your prior post you say "button"?

    Maybe this is where you needed to look?
    http://extjs.com/deploy/dev/docs/?cl...member=toolbar

    Creates a new Toolbar
    Parameters:

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •