PDA

View Full Version : toggle wierd behavior



gkatz
23 Nov 2011, 8:37 AM
Hi; using sencha 1.1
I dont know if this was meant to be like this. but the following code:


items: [
{
xtype: 'fieldset',
title: 'on/off',
items: [{
xtype: 'togglefield',
name:"name",
label:"label",
value:0,
listeners: {
change: function(slider, thumb, newValue, oldValue){
//check oldValue here
}
}
}],
}]


will fire a change event on startup having the oldValue's value be "". this is kinda strange.
1. why would an event be fired in the first place if there was no user gesture or a programatuc call
2. why send "" as the old value
am I missing something?
thanks

mitchellsimoens
23 Nov 2011, 11:30 AM
The reason is because internally, setValue is called which will then call the change event.