Results 1 to 2 of 2

Thread: 4.2.1 MVC issue: controller catching another views' events

  1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    119
    Answers
    4

    Default Answered: 4.2.1 MVC issue: controller catching another views' events

    portalui.jpgI have this weird issue with ExtJS 4.2.1.


    I have a controller whose listeners catch events from a view that it shouldn't.


    Here's said controller:
    Code:
    Ext.define('Customer_Portal_UI.controller.NavigationMenu', {
        extend: 'Ext.app.Controller',
        init: function () {
            this.control({
                'panel': {
                    render: function (panel) {
                        panel.body.on('click', function (panel, e) {
                            alert('onclick');
                        });
                    }
                }
    
    
    
    
            });
    
    
        }
    });
    It 'controls' this view:
    Code:
    Ext.define('Customer_Portal_UI.view.NavigationMenu', {
        extend: 'Ext.form.Panel',
        alias: 'widget.navigationmenu',
        region: 'west',
        layout: 'fit',
        ui: 'cssmenu',
        loader: {
            autoLoad: true,
            url: '/resources/notloggedin.html'
        }
    
    
    });



    But it also catches panel clicks from this view:
    Code:
    Ext.define("Customer_Portal_UI.view.MainContent", {
        extend: 'Ext.form.Panel',
        alias: 'widget.maincontent',
        region: 'center',
        layout: 'card',
        border: false,
        activeItem: 0,
        requires: ['Ext.grid.Panel'],
        initComponent: function () {
    
    
            this.items = [
                                    {
                                        xtype: 'panel',
                                        title: ''
                                    },
                                    {
                                        xtype: 'gridpanel',
                                        id: 'contactlistgrid',
                                        store: Ext.data.StoreManager.lookup('contactStore'),
                                        columns: [
                        ....
                                        ],
                                        features: [{
                                            ftype: 'grouping',
                                            groupHeaderTpl: ['{columnName}: {name} - ({rows.length} employees)'],
                                            hideGroupedHeader: true,
                                            startCollapsed: false
                                        }],
                                        viewConfig: { id: 'contactlistgridview' }
                                    },
                                    {
                                        xtype: 'gridpanel',
                                        id: 'caselistgrid',
                                        store: Ext.data.StoreManager.lookup('caseStore'),
                                        columns: [
                                                    { text: 'Title', dataIndex: 'title' },
                                                    { text: 'Description', dataIndex: 'description' },
                                                    { text: 'Ticket number', dataIndex: 'ticketnumber' }
                                        ],
                                        viewConfig: { id: 'caselistgridview' }
                                    }
                    ]
    
    
    
    
            this.callParent(arguments);
        }
    });
    Anything obvious I'm doing wrong ? I've attached a screenshot of the layout. I just want to add a listener on the panel that's holding the menu to the left ("Login").

    But it's also triggering when I click all over the panel in the middle with the X on. Also, when I debug, the value of e.ID is always the one of the "Login" item, even when I click right in the middle.

  2. I found this did the trick

    http://www.fusioncube.net/index.php/...comment-page-1

    This way I can listen to 'click' event for 'panel' in my controller.

  3. #2
    Sencha User
    Join Date
    Jul 2010
    Posts
    119
    Answers
    4

    Default

    I found this did the trick

    http://www.fusioncube.net/index.php/...comment-page-1

    This way I can listen to 'click' event for 'panel' in my controller.

Posting Permissions

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