0

I have grid with filter and on the filter i want to show a list of items. By focusing the filter option I should see a list of items with check boxes and when I click on the check box it should send the params. I achieved this by loading local data and I want the same by loading remote data how can I achieve it. { dataIndex: 'adjustmentTypeDescription', text: 'Adjustment
Type', stateId: 'adjustmentgrid_adjustmentTypeDescription', filter: { type: 'list', labelField: 'name', dataIndex: 'adjustmentTypeId',

        store: Ext.create('Ext.data.ArrayStore', {
            fields: [{
                name: 'id',
                type: 'int'
            }, {
                name: 'name',
                type: 'string'
            }],
            data: [
                [2, 'AA'],
                [13, 'AFF'],
                [11, 'DDD'],
                [15, 'Dd'],
                [5, 'Fdsdt'],
                [6, 'Ide']
                [10, 'Return/Reject']
            ]
        })}

Now I want to load this data from the service. I tried this way:

            store: Ext.create('Ext.data.ArrayStore', {
            autoLoad: false,
            model: 'ModelName',
                        /*fields: [{
                                name: 'adjustmentTypeId',
                                type: 'int'
                            }, {
                                name: 'description',
                                type: 'string'
                            }],*/
                        proxy: {
                            type: 'ajax',
                            url: 'servicurl',
                            timeout:120000,
                            reader: {
                                type: 'array',
                               // rootProperty: 'data',
                                rootProperty:function(data){
                                    debugger;
                                    return data;
                                    debugger;
                                    //console.log(bb);
                                }
                            }
                        }/*,
                        listeners: {
                            load: function(store, records, successful, 
                      operation, eOpts){
                                debugger;
                                var data = [];
                                for(var i = 0; i< 1; i++){

                   //data.push(records[i].data.description);
                                    var vare = new Array();
                                    vare[0]= records[i].data.description;
                                    data.push(vare);

                                }

                                store.loadData(data);
                                console.log(data);
                            }
                        }*/
            })

but didn't work how can I achieve this by making a service call and loading the remote data.

Sweety
  • 31
  • 6

1 Answers1

0
  1. Set autoLoad: true

  2. Remove the reader config object. Since you are using an ArrayStore, this is not needed. And array data is positional so rootProperty is not used.

  3. Check that you have defined the Model fields correctly.

It should work.

Amita Suri
  • 309
  • 1
  • 7
  • My mistake actually the store shoudn't be ArrayStore because the data from the server is in json format: – Sweety Oct 19 '17 at 20:05
  • I changed it to json reader and got it https://fiddle.sencha.com/#view/editor&fiddle/28ko – Sweety Oct 20 '17 at 14:01