Extjs table/grid auto expand to full

浪子不回头ぞ 提交于 2019-12-11 11:46:55

问题


How do I go about making the gridpanel/table in extjs auto expand based on the window size? Thanks I added layout :'fit'.. i didn't change much

var listView = Ext.create('Ext.grid.Panel', {
    store: mystore,
    multiSelect: true,
title:'Notifications for ' + jsonServiceId + ' <i>(0 items selected)</i>',
    viewConfig: {
        emptyText: 'No images to display'
    },
    //reserveScrollOffset: true,
renderTo: containerEl,
         layout:'fit',

    columns: [{
        text: 'Sell',
        flex: 10,
        dataIndex: 'Sell',
       renderer: function(value, metaData, record) {
       //  alert(record.get('Sell'));


  }
    },{
        text: 'Class',
        flex: 10,
        dataIndex: 'ClassName'
    },


  {
        text: 'Last Changed',
        flex: 20,
        dataIndex: 'LastChangedAt',
  xtype: 'datecolumn',
        format: 'd-M-Y h:i a'
    }
]     
});

回答1:


It's a layout thing. You should add layout: 'fit' to the parent container. It will make your grid expand to the size of parent container.

Just as here in example:

http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/layout-browser/layout-browser.html



来源:https://stackoverflow.com/questions/9104227/extjs-table-grid-auto-expand-to-full

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!