如何在Extjs grid.panel中显示数据

时间:2012-02-28 06:13:42

标签: extjs grid extjs4

这是初始化视图的正确方法吗? 我有这段代码:

Ext.define('AS.view.View', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.view',
    store: 'Store',

    initComponent: function () {}
});

商店是在网格上配置的,不应该看到数据吗?有人能帮助我吗?

1 个答案:

答案 0 :(得分:0)

  1. 您应该将this.callParent(arguments);放在initComponent方法
  2. 您可以在视图呈现时自动加载商店或在商店中调用load()。
  3. 或者:

    //store config
    autoLoad: true
    

    //view config
    listeners: {
       render: function(){
           this.store.load();
       }
    }
    

    您还需要配置列。 请参阅完整的工作示例:http://docs.sencha.com/ext-js/4-0/#!/example/grid/array-grid.html