1. #1
    Sencha User nak1's Avatar
    Join Date
    Jan 2008
    Posts
    254
    Vote Rating
    -1
    Answers
    1
    nak1 is an unknown quantity at this point

      0  

    Default Unanswered: Ext.field.Select using Store

    Unanswered: Ext.field.Select using Store


    I've got a question; when I reload a store that is being used by an Ext.field.Select object, it fires the "change" event, even though the user hasn't selected a new option. I was wonder if there was a way to avoid the Select field from selecting the first item, or is there some other listener that I'm missing which would be more like a "select" event?
    No longer a Newbie

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    438
    Answers
    3113
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You would have to override the Select field to do that. It is at the end of the showPicker method:

    Code:
        showPicker: function() {
            //check if the store is empty, if it is, return
            if (this.getStore().getCount() === 0) {
                return;
            }
    
            if (this.getReadOnly()) {
                return;
            }
    
            this.isFocused = true;
    
            //hide the keyboard
            //the causes https://sencha.jira.com/browse/TOUCH-1679
            // Ext.Viewport.hideKeyboard();
    
            if (this.getUsePicker()) {
                var picker = this.getPhonePicker(),
                    name   = this.getName(),
                    value  = {};
    
                value[name] = this.record.get(this.getValueField());
                picker.setValue(value);
                if (!picker.getParent()) {
                    Ext.Viewport.add(picker);
                }
                picker.show();
            } else {
                var listPanel = this.getTabletPicker(),
                    list = listPanel.down('list'),
                    store = list.getStore(),
                    index = store.find(this.getValueField(), this.getValue(), null, null, null, true),
                    record = store.getAt((index == -1) ? 0 : index);
    
                if (!listPanel.getParent()) {
                    Ext.Viewport.add(listPanel);
                }
    
                listPanel.showBy(this.getComponent());
                list.select(record, null, true);
            }
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User nak1's Avatar
    Join Date
    Jan 2008
    Posts
    254
    Vote Rating
    -1
    Answers
    1
    nak1 is an unknown quantity at this point

      0  

    Default


    Thanks for the response. I was wondering, is it possible to accomplish what you're suggesting with a sequence process? I'm a litltle leary of overriding the entire method.
    No longer a Newbie