There doesn't seem to be direct way in ExtJS to indicate that all items in a class should bubble events. Below is simple workaround - we iterate over all the items in the class in the 'afterRender' event:
Ext.BLANK_IMAGE_URL = 'lib/ext/resources/images/default/s.gif';
Ext.onReady(function() {
Ext.QuickTips.init();
FP = Ext.extend(Ext.form.FormPanel, {
frame: true,
initComponent: function() {
var config = {
items: [{
xtype: 'textfield',
name: 'First',
fieldLabel: 'First'
}, {
xtype: 'textfield',
name: 'Second',
fieldLabel: 'Second'
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
FP.superclass.initComponent.apply(this, arguments);
this.on('change', function(field, newVal, oldVal) {
console.log('form change event on ' + field.name);
}, this);
},
// When the form has been rendered, we step though all the items on
// the form and enable bubbling for each one. In a more complex form
// we would need to check the type of each item and enable the right
// kind of events, of course.
afterRender: function() {
FP.superclass.afterRender.apply(this, arguments);
Ext.each(this.items.items, function(item) {
item.enableBubble('change');
}, this);
}
});
var fp = new FP();
var win = new Ext.Window({
items: [fp]
});
win.show();
});
