Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If you can repeat the value of the itemId property, then how is controlQuery know which item is supposed handle?

eg.

So if we have button1, then the event should trigger everytime button1 is pressed no matter if its in panel1, panel2 or panel3.
Posted
Updated 4-Sep-12 20:10pm
v2
Comments
enhzflep 5-Sep-12 3:49am    
You can't, which is precisely the reason that id must be unique. If you wish to 'group' similar items, you should use the class attribute instead. The buttdoesn't need an id or a class to be clickable, for what its worth. :)

1 solution

The event can be added at the controller level

JavaScript
init: function () {
        this.control({
            'button[itemId=testButton]': {
                click: this.OnClickTestButton
                    });
        this.callParent(arguments);
    },
OnClickTestButton: function (btn) {
}


Example can be found in below link.
http://docs-origin.sencha.com/extjs/4.2.1/#!/api/Ext.app.Controller-method-control[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900