Results 1 to 2 of 2

Thread: Clear Select Field's Value on an event

  1. #1
    Sencha Premium Member
    Join Date
    Aug 2011
    Location
    Denver, CO
    Posts
    15

    Default Clear Select Field's Value on an event

    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.


    Code:
    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!

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    You should be able to do something like this:

    Code:
    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().
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •