PDA

View Full Version : enableBubble and radio



dizor
24 Jun 2010, 8:05 AM
I have problem with enableBubble and radios.



items: [{
xtype: 'radiogroup',
fieldLabel: 'Test radio',
name: 'customers_contract',
columns: 12,
items: [{
boxLabel: 'A',
name: 'customers_contract',
inputValue: 'on'
},{
boxLabel: 'B',
name: 'customers_contract',
inputValue: 'off'
}]
}]




Ext.override(Ext.form.Field, {
initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {
this.enableBubble('change');
console.log(this);
})
});


Listener "change" is on formPanel. When I load form everything is ok (textfield etc.) but radios in radio group fired with "change". Any help with this?

Animal
24 Jun 2010, 9:32 AM
Radiogroup's change event fires on checkchange of any of its constituent radio buttons.

dizor
24 Jun 2010, 10:26 AM
If i remove "inputValue" then it's ok (but of course i need it). I want detect change formpanel items - and have problem only with radios - because when i load data into form (with customers_contract: "on" orr "off"), radios fires on 'change' - when "customers_contract" = null - then is ok.

Animal
24 Jun 2010, 10:40 AM
OK. So your problem is that the change event fires on form load?

I can see that's not great. You'll have to use a flag to ignore it if form is loading.

dizor
24 Jun 2010, 10:44 AM
OK. So your problem is that the change event fires on form load?

Exactly...

I thought about ignore flag, but was hoping that there is a better solution.

Is any easy method for this flag?

dizor
24 Jun 2010, 10:51 AM
listeners: {
'change': {
fn: function (t) {
if(this.formPanel.customLoadingFlag != true) {
this.win.header.setStyle('color', 'red');
}
},
scope: this
}
}


Something like this?

My idea doesn't work... if i change flag on load success problem still exists.
Suspend and reasume events doesn't work too.