1. #1
    Sencha User
    Join Date
    Dec 2010
    Posts
    10
    Vote Rating
    0
    kishore_r is on a distinguished road

      0  

    Default Combobox.select() not firing event

    Combobox.select() not firing event


    I have the following code in my contoller
    Code:
    Ext.define('MyApp.controller.Installation', {
        extend: 'Ext.app.Controller',
    
    
      refs: [{
            ref: 'installationsCombo',
            selector: 'breadcrumb combobox'
        }],
            
        stores: ['Installations'],
        
        models : ['AppState'],
    
    
        init: function() {
            // Start listening for events on views
            this.control({
                'breadcrumb combobox': {
                    select: this.onInstallationSelect,
                    scope: this
                }
            });
        },
    
    
        onLaunch: function() {
            var installationsStore = this.getInstallationsStore();
            installationsStore.load({
                callback: this.onInstallationsLoad,
                scope: this
            });
        },
    
    
        onInstallationsLoad: function() {
            var installationsCombo = this.getInstallationsCombo();
            installationsCombo.select(1);
        //installationsCombo.fireEvent("select", this.getInstallationsStore().getAt(0));;
        },
    
    
        onInstallationSelect: function(selModel, selection) {
            console.log("Installation selection changed");
    
            this.getAppStateModel().selectedInstallationId = selection[0].get('installationId');
            this.getAppStateModel().selectedInstallationName = selection[0].get('name');
            
           // Fire an application wide event
            this.application.fireEvent('installationSelect', selection[0]);
            console.log("Installation Select Event fired");        
        },

    The problem I am facing is that the " installationsCombo.select(1); " is not firing the select event and hence the onInstallationSelect method is not being called. I use this event to load other parts of the application. When I make a selection from the combobox manually, everything works.

    Any ideas as to why the select() method on the combo box is not firing the select event?

    Thanks in advance.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Vote Rating
    855
    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


    Does change fire for both selection and using setValue?
    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.

Thread Participants: 1