开发者

ExtJs. Easyest way to show empty grid

开发者 https://www.devze.com 2023-03-18 20:12 出处:网络
I\'m using ExtJs 4. I have a grid, but i don\'t have a store or columns pre defined. 开发者_如何学运维I just don\'t know what grid should be showing. But i still nead to render grid using Json markup.

I'm using ExtJs 4. I have a grid, but i don't have a store or columns pre defined. 开发者_如何学运维I just don't know what grid should be showing. But i still nead to render grid using Json markup.

I want to do something like this:

//grid with empty store and no collumns
{ 
    xtype: 'grid',
    columns: [],
    store: new ArrayStore([])
}

What is the easyest way to do this?


You can't load create a grid without any columns.. however you can create one without any data (just set store to autoload: false). For example..

{
   xtype: 'grid',
   //..other config here
   store: new Ext.data.JsonStore({
      url: 'store/url.php',
      autoLoad: false
   }),
   cm: new Ext.grid.ColumnModel({
     columns: [
        { dataIndex: 'id', header: ' ' }
     ]
   })
}
0

精彩评论

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