PDA

View Full Version : Bubble events with prefix



vietits
28 Jan 2012, 12:24 AM
This is an override that allows you to bubble events with prefix. It works by overriding the Ext.Component.initComponent() to inject some codes to relay events with prefix and then enable to bubble them.

How to use
Just load the override and then set bubbleEvents and bubblePrefix in the item config. When bubblePrefix is missing, bubbleEvents works as normal.

Example


Ext.create('Ext.panel.Panel', {
...
tbar: [{
xtype: 'button',
text: 'Save',
bubbleEvents: ['click'],
bubblePrefix: 'savebtn' // fires and bubbles 'savebtnclick' when this button is clicked
},{
xtype: 'button',
text: 'Delete',
bubbleEvents: ['click'],
bubblePrefix: 'deletebtn' // fires and bubbles 'deletebtnclick' when this button is clicked
}]
...
});

Source code
31110