开发者

Extjs - Getting more from the server

开发者 https://www.devze.com 2023-01-02 01:29 出处:网络
Is it possible to get every data from the server? For example, I want to get the columns items from the server Via Ajax/Proxy by sending json string?

Is it possible to get every data from the server?

For example, I want to get the columns items from the server Via Ajax/Proxy by sending json string?

var grid = new Ext.grid.GridPanel({
    store: store,
    columns: [{
        id: 'company',
        header: 'Company',
        width: 160,
        sortable: true,
        dataIndex: 'company'
    }, {
        header: 'Price',
        width: 75,
        sortable: true,
        renderer: 'usMoney',
        dataIndex: 'price'
    }, {
        header: 'Change',
        width: 75,
        sortable: true,
        renderer: change,
        dataIndex: 'change'
    }, {
        header: '% Change',
 开发者_Python百科       width: 75,
        sortable: true,
        renderer: pctChange,
        dataIndex: 'pctChange'
    }, {
        header: 'Last Updated',
        width: 85,
        sortable: true,
        renderer: Ext.util.Format.dateRenderer('m/d/Y'),
        dataIndex: 'lastChange'
    }],
    stripeRows: true,
    autoExpandColumn: 'company',
    height: 350,
    width: 600,
    title: 'Array Grid',
    stateful: true,
    stateId: 'grid'
});


Yes you can.

you can get the whole code in your example generated by the server and eval'd on the client, or you can have for example the array of the columns returned as a JSON object, parsed by the client, and then use the created object as the "columns" config option in your code that created a grid.

Since JavaScript is interpreted and you can download text from the server you can do just about any trick like this.


Send your data through the "metaData" property. Therefore, the Store will fire an "metachange" event, and you can perform reconfigure on the grid with the following method:

grid.reconfigure(store, new Ext.grid.ColumnModel(metaData.columns));
0

精彩评论

暂无评论...
验证码 换一张
取 消