1. #1
    Sencha User nak1's Avatar
    Join Date
    Jan 2008
    Posts
    266
    Vote Rating
    0
    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
    Gainesville, FL
    Posts
    37,652
    Vote Rating
    901
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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
    ________________
    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 in print!

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

  3. #3
    Sencha User nak1's Avatar
    Join Date
    Jan 2008
    Posts
    266
    Vote Rating
    0
    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

Thread Participants: 1