christian130
christian130

Reputation: 21

Ext.data.Store does not reload immediately

when trying to populate A ENTIRE GRID using the ajax from a combobox in the select listener when i try to recall or reload the datastore i'm still getting the old values, instead of the new ones. i have to get the new values because according to the parameter selected in the combobox the textfields and the others editor will populate with that json data read from server using ajax, accoding with another combobox that fetch remote data

var cm = new Ext.grid.ColumnModel({
        defaults: {
            sortable: true
        },
        columns: [{
            id: 'ci',
            header: 'Periodo Declarado',
            dataIndex: 'ci',
            width: 150, 
            editor: new fm.ComboBox({
                typeAhead: true,
                triggerAction: 'all',
                transform: 'PerDecl',
                lazyRender: true,
                listClass: 'x-combo-list-small',
                mode:'local',
                listeners:{
                expand: function (combo){
                //alert("asd");
            },
            collapse: function(combo,record,number){
            },
                select:function(v, params, record){
                ds_random_employee_data_active.remove();
                var varAnio2=v.getValue();
                var ds_random_employee_data_active2=ds_random_employee_data_active;
                ds_random_employee_data_active2.load({ params: { anio: varAnio2 } });
                Ext.each(ds_random_employee_data_active2.data.items, function(record){
                    alert(record.data.ut);
                });
                //setTimeout("tres("+ v +"[]);",1000);

            }}  



            })
        }

***********others columns************************

Upvotes: 0

Views: 2279

Answers (3)

christian130
christian130

Reputation: 21

[SOLVED] THANKS U ALL for say i figure it out after four hours or more the way i did is seemed to bmoeskau but i did read the post of bmoeskau after i've got with the solution thanks u to all

store.load({params:{anio:varanio},callback:function(){// here comes the loop or another instruction }}) this is a nice forum chat

Upvotes: 1

Brian Moeskau
Brian Moeskau

Reputation: 20431

If you (re)load a data store, the call is asynchronous, so any action that relies on the updated data must be done within a callback. You can handle the store's load event to do that. See my answer here for an example.

Upvotes: 0

user399319
user399319

Reputation: 1

That's because it loads asynchronously.

Upvotes: 0

Related Questions