Threaded View

  1. #1
    Sencha User
    Join Date
    Feb 2009
    Location
    India
    Posts
    70
    Vote Rating
    1
    arvindwill is on a distinguished road

      0  

    Default Answered: Panel click event

    Answered: Panel click event


    Since panel dont have click event cant able to attach listeners in mvc style. What is the equivalent way to achieve panel click event in MVC design

  2. Try this:

    1. View code
    Code:
    Ext.define('App.view.Panel', {
        extend: 'Ext.panel.Panel',
        alias: 'widget.apppanel',
        bodyCls: 'entity_draw',
        ...
        listeners: {
            click: {
                element: 'el',
                fn: function(){
                    var panel = Ext.getCmp(this.id);
                    panel.fireEvent('click'); // fire 'click' event from panel
                }
            }
        }
    });
    2. Controller
    Code:
    ...
    init: function(){
        this.control({
            'apppanel': { // 'panel[bodyCls=entity_draw]'
                click: function(){
                    console.log('panel is clicked');
                }
            }
        });
    }

Thread Participants: 1

Tags for this Thread