ExtJS 3.0.0:窗口中的GridPanel,ArrayStore不呈现任何数据

时间:2015-08-14 13:14:32

标签: javascript extjs window extjs3 gridpanel

我正在尝试在一个Window中放置一个由ArrayStore驱动的GridPanel,但不管我做什么,它看起来都像这样,里面没有数据行:

这是我的代码:

           var ticketsStore = new Ext.data.ArrayStore
            (
                {
                    autoDestroy: false,
                    remoteSort: false,
                    data: result,
                    fields:
                    [
                        { name: 'articleId', type: 'int' },
                        { name: 'heatTicketRef', type: 'string' },
                        { name: 'username', type: 'string' },
                        { name: 'dateLinked', type: 'date' }
                    ]
                }
         );

        var ticketsGrid = new Ext.grid.GridPanel({
            store: ticketsStore,
            id: this.id + 'ticketsGrid',
            viewConfig: {
                emptyText: 'No data'
            },
            autoShow: true,
            idProperty: 'heatTicketRef',
            columns: [
                { id: 'heatTicketRef', header:"Ticket ID", width: 100, dataIndex: 'heatTicketRef', sortable: false },
                { header: "User", width: 100, dataIndex: 'username', sortable: false },
                { header: "Date Linked", width: 100, dataIndex: 'dateLinked', xtype: 'datecolumn', format: 'j M Y h:ia', sortable: false }
            ]
        });
        var window = new Ext.Window
          (
            {
                renderTo: Ext.getBody(),
                id: this.id + 'linkedHeatTickets',
                closable: true,
                modal: true,
                autoHeight: true,
                width: 500,
                title:'Linked Heat Tickets',
                resizable: false,
                listeners:
                {
                    close: function () { // do something }
                },
                items:
                {
                    style: 'padding:5px;',
                    items: ticketsGrid
                },
                buttons:
                {
                    text: 'Close',
                    handler: function () {
                        window.close();
                    }
                }
            }
        );

        window.show();

当我调试时,我可以看到我的“结果”对象是健康的并且ArrayStore的长度合适:

但是GridPanel不喜欢这些数据,因为它不在它的项目中(尽管它在商店中)数组:

我做错了什么小事?

谢谢!

1 个答案:

答案 0 :(得分:0)

因为我是个白痴......我使用的是ArrayStore而不是JsonStore!