Pari
Pari

Reputation: 339

How to load Ext.grid.GridPanel from Ext.data.Store(with use of parameter)?

I am using following code to get value from php file:

var genres1 = new Ext.data.Store({
            reader: new Ext.data.JsonReader({
                fields: ['pincode'],
                root: 'rows'
            }),
            baseParams: {
        param1: startptx1,
        param2: startpty1,
            param3: endptx1,
            param4: endpty1
            },
            proxy: new Ext.data.HttpProxy({
                url: 'pointalong.php',
                method: 'GET'
            }),
            autoLoad: true
        });

Now i want to display this in table so i am using following code:

var grid = new Ext.grid.GridPanel({
            renderTo: 'td_info',
            frame: true,
            title: 'Direction From Start To End',
            height: 435,
            width: 300,
            store: genres1,
            colModel: new Ext.grid.ColumnModel({
                defaultSortable: false,
                columns: [
                    {header: "PinCode", dataIndex: 'pincode'},
                    //{header: "Place", dataIndex: 'place_name'}
                                        ]
            })
        });

But data is fetch using Ext.data.Store but not loaded in Ext.grid.GridPanel(this is created). I have put Ext.data.Store and Ext.grid.GridPanel in function that is loaded on click of button.

Upvotes: 0

Views: 2523

Answers (2)

Zaved Warsi
Zaved Warsi

Reputation: 11

Instead of using reader into new Ext.data.JsonStore

reader: new Ext.data.JsonReader({
            fields: ['pincode'],
            root: 'rows'
        }),

Always use fields: ['pincode']

for me is is working like this.

Upvotes: 1

Nandkumar Tekale
Nandkumar Tekale

Reputation: 16158

Please Make sure that record is given to reader and root property of reader is set correctly use mapping in fields or '>' in mapping

Upvotes: 0

Related Questions