Results 1 to 2 of 2

Thread: catching change on menu in mvc

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    80
    Answers
    1

    Default catching change on menu in mvc

    i'm having a few issues catching the change event on menu

    I've tried the following in my controller

    Code:
                '#selectFilter': {                selectionchange: this.onSelectFilter,
                    change: this.onSelectFilter,
                    itemmousedown: this.onSelectFilter
                },
    Code:
    	items:[
                    {
                        xtype:'panel',
                        layout:{
                            type:'column'
                        },
                      //  border:0,
                        columnWidth:0.5,
                        tbar: [{
                            xtype       : 'button',
                            id:         'selectFilter',
                            text        : 'Select Filter By',
                            itemId      : 'filter_by',
                            arrowAlign  : 'right',
                            menu        : [{
                                text    : 'Client',
                                checked : true,
                                group   : 'filter',
                                itemId  : 'ClientFrom',
                                id      : 'ClientFrom'
                            },{
                                text    : 'Supplier',
                                checked : false,
                                group   : 'filter',
                                itemId  : 'Supplier'
                            },{
                                text    : 'Delivery',
                                checked : false,
                                group   : 'filter',
                                itemId  : 'Delivery'
                            }]
                        }]
                    }
                ]

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    347

    Default

    1. Menu does not have 'change' event. You should catch 'click' event when user click on one of its items.

    2. You should use id or itemId but not both. In case you use both, itemId will have higher priority.

    Below is my suggestion basing on your code:
    Code:
    '#filter_by menu':{ // use itemId in selector
        click: function(menu, item){
            console.log('item clicked', item);
        }
    }

Posting Permissions

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