PDA

View Full Version : Clear Select Field's Value on an event



aswinramakrish
4 Nov 2011, 8:46 AM
I have 2 select fields where, the second select field loads on the first select field's change event. That is, the second select field is dependent on the first select field's value.Something like this.



listeners: {
change: function(this, value){
//Pass value parameter to the 2nd select field's store
}
}

Though this works fine. I would like to clear the second select field's value when the first select field is selected i.e. dropped down.I'm new to Sencha Touch, so I'm not sure if there are any events / methods available that I can use to get this thing working.To be more clear - In Ext JS, we have a clearValue() method to clear the combo box's value. I'm looking for something similar with the Sencha Touch 1.1.Any help towards the right direction will be highly appreciated.Thanks!

mitchellsimoens
4 Nov 2011, 11:23 AM
You should be able to do something like this:


var form = select.up('formpanel'),
nextSelect = form.down('selectfield[prop=val]');

nextSelect.setValue('');

You have to set a property on the 2nd selectfield and update the ComponentQuery in the down().