1
votes

I found this extjs script that create a empty gridpanel:

    var gridz = new Ext.grid.GridPanel({
   // store: dstore,
        columns: [
        {id:'id', header: "Id", width: 60,  sortable: true, dataIndex: 'id'},
        {id: 'data', header: "Data", width: 200, sortable: true, dataIndex: 'data'}
        ],
        stripeRows: true,
        autoExpandColumn: 'data',
        height:350,
        width: 500,
        title:'Demo Data'
    });

now is question: I have table called answers, how i can put my data from database intro this grid?

1

1 Answers

2
votes

The bit that you've commented out, 'store', is responsible for storing your data. You may wish to use a JsonStore, for example, which makes a request to your server to get the answers in JSON format. You then create a column model (that's the 'columns' property in your example') for the grid that knows which fields in your store map to columns in your grid.

There are some tutorials here that it'd be worth you reading through: http://www.sencha.com/learn/Tutorials#Grids. They may be for older versions of ExtJS than you're using but the principle is still the same.