Results 1 to 2 of 2

Thread: How to send extra information when store.load complete?

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    10

    Default How to send extra information when store.load complete?

    Hi everyone
    I have 2 combobox, and their data is filled by 2 stores.
    When I select my first comboBox, the event is raise, and load the store for the second comboBox.
    My problem is I need to send extra information from server to client when I call store.load().

    I have tried messageProperty/successProperty/totalProperty but no hope
    I also tried load event in store but still no luck

    Code:
           //country comboBox Store
            var countryComboBoxStore = new Ext.data.JsonStore(
            {
                url: '@Url.Content("~/InitializecountryComboBox")',
                autoLoad: false,
                idProperty: 'id',
                autoSave: true,
                messageProperty: 'message',
                root: 'countrys',
                fields: ['id', { name: 'country_', type: 'string'}],
                listener: {
                    load: new function (store, records, options) {
                        alert("load");
                    },
                    datachanged: new function (store) {
                        alert("Data change");
                    }
                }
            });
            countryComboBoxStore.setDefaultSort('country_', 'asc');
    
    
            //country Combobox pop up
            var countryComboPopUp = new Ext.form.ComboBox({
                id: 'countryComboPopUp',
                typeAhead: false,
                triggerAction: 'all',
                fieldLabel: 'country',
                editable: false,
                lazyRender: true,
                mode: 'local',
                store: countryComboBoxStore,
                valueField: 'id',
                displayField: 'country',
                listeners: {
                    select: function (combo, record, index) {
                        var selectedcityId = comboPopUp.getValue();
                        var selectedcountryId = countryComboPopUp.getValue();
                        comboBoxStore.load(
                            {
                                params: { selectedcityId: selectedcityId, selectedcountryId: selectedcountryId }
                            });
                        //                        comboPopUp.clearValue();
                        //                        comboPopUp.applyEmptyText();
                    }
                }
            });
    
    
            //country  Combobox
            var countryCombo = new Ext.form.ComboBox({
                id: 'countryCombo',
                typeAhead: false,
                triggerAction: 'all',
                fieldLabel: 'city',
                editable: false,
                lazyRender: true,
                mode: 'local',
                store: countryComboBoxStore,
                valueField: 'id',
                displayField: 'country_'
            });
    
    
            //city comboBox Store
            var comboBoxStore = new Ext.data.JsonStore(
            {
                url: '@Url.Content("~/InitializeComboBox")',
                autoLoad: false,
                idProperty: 'id',
                root: 'listcity',
                messageProperty: 'message',
                autoSave: true,
                fields: ['id', { name: 'city1', type: 'string'}]
            });
            comboBoxStore.setDefaultSort('city1', 'asc');
    
    
            // create the comboBox in pop up
            var comboPopUp = new Ext.form.ComboBox({
                id: 'city',
                typeAhead: false,
                triggerAction: 'all',
                fieldLabel: 'city',
                editable: false,
                lazyRender: true,
                mode: 'local',
                store: comboBoxStore,
                valueField: 'id',
                displayField: 'city1',
                listeners: {
                    select: function (combo, record, index) {
                        var selectedcityId = comboPopUp.getValue();
                        var selectedcountryId = countryComboPopUp.getValue();
                        countryComboBoxStore.load({ params: { selectedcityId: selectedcityId, selectedcountryId: selectedcountryId} });
                        //countryComboPopUp.clearValue();
                        //countryComboPopUp.applyEmptyText();
                    }
                }
            });
    
    
            //Create the comboBox in grid
            var combo = new Ext.form.ComboBox({
                typeAhead: false,
                triggerAction: 'all',
                editable: false,
                lazyRender: true,
                mode: 'remote',
                store: comboBoxStore,
                valueField: 'id',
                displayField: 'city1'
            });
    Please help me
    Any idea is appropriated

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

    Default

    What "extra information" are you sending and how are you sending it?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

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

Posting Permissions

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