Results 1 to 3 of 3

Thread: [SOLVED] Menu Checkitem state not working

  1. #1
    Ext User
    Join Date
    Jul 2009
    Location
    Mons > Belgium
    Posts
    25

    Exclamation [SOLVED] Menu Checkitem state not working

    Hello,

    I'm struggling with this since a couple of days now and I can't figure it out.

    I have a menu in a panel and I want to save the state of the checkbox uppon reloading.

    This is the menu code:
    Code:
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    
    menu: new Ext.menu.Menu({
                        items: [{
                            text: 'Send mail',
                            checked: false,
                            value: "send-mail"
                            checkHandler: dataConfig,
                            stateful:true,
                            stateId: "send-mail",
                            stateEvents: ['check'],
                            getState: function() {
                                return {checked: this.getValue()}
                            },
                            applyState: function(state) {
                                this.setValue(state.checked);
                            }
                        }]
    });
    It seems to work when I set a
    Code:
    xtype: 'checkbox'
    but it doesn't display correctly in the menu.

    Do you have an idea to help ?

    Thanks

  2. #2
    Ext User
    Join Date
    Jul 2009
    Location
    Mons > Belgium
    Posts
    25

    Default [SOLVED]

    Solve thanks to evant on IRC:

    Here is the solution:

    Code:
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    
    menu: new Ext.menu.Menu({
                        items: [{
                            text: 'Send mail',
                            checked: false,
                            value: "send-mail"
                            checkHandler: dataConfig,
                            stateful:true,
                            stateId: "send-mail",
                            stateEvents: ['click'],
                            getState: function() {
                                return {checked: this.checked}
                            },
                            applyState: function(state) {
                                this.checked = state.checked;
                            }
                        }]
    });

  3. #3
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    44

    Default checkchange event works better if you have multiple items in the menu.

    checkchange event works better if you have multiple items in the menu.

Posting Permissions

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