grid - extjs 网格 - 如何使列宽 100%

标签 grid extjs4

楼盘width是像素宽度。

{
                xtype: 'grid',
                store: store,
                selModel: Ext.create('Ext.selection.CheckboxModel', {
                    mode: 'SINGLE'
                }),
                layout: 'fit',
                columns: [
                    {
                        text: "pum",
                        dataIndex: 'SRD_NAME_FL',
                        width: 400
                    }
                ],
                columnLines: true
            }

如果我只有一列,我怎样才能使列宽 = 100%
或者如果我有几列 - 如何使最后一列拉伸(stretch)到网格的末尾?

最佳答案

对于 ExtJS3,设置 forceFit在 GridPanels viewConfig .见:http://dev.sencha.com/deploy/ext-3.4.0/docs/?class=Ext.grid.GridView

对于 ExtJS 4 集 forceFit直接在 GridPanel 上:http://docs.sencha.com/ext-js/4-0/#/api/-cfg-forceFit并与 flex 结合使用在你的专栏上。

v4 示例

var p = Ext.Create('Ext.grid.Panel',{
    forceFit: true,
    columns: [{
        xtype: 'gridcolumn',
        header: _ll.id,
        sortable: true,
        resizable: false,
        flex: 0, //Will not be resized
        width: 60,
        dataIndex: 'Id'
    }, {
        xtype: 'gridcolumn',
        header: __ll.num,
        sortable: true,
        resizable: true,
        flex: 1,
        width: 100,
        dataIndex: 'number'       
    }
});

v3 示例
var p = new Ext.grid.GridPanel({
    viewConfig: {
            forceFit: true
    },
    columns: [{
        xtype: 'gridcolumn',
        header: _ll.id,
        sortable: true,
        resizable: false,
        fixed: true, //Will not be resized
        width: 60,
        dataIndex: 'Id'
    }, {
        xtype: 'gridcolumn',
        header: __ll.num,
        sortable: true,
        resizable: true,
        width: 100,
        dataIndex: 'number'       
    }
});

关于grid - extjs 网格 - 如何使列宽 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6545719/

相关文章:

javascript - 如何 "sort"特定色调的颜色

grid - Tkinter 网格列跨度被忽略

css - 如何在 Susy2 的流体网格系统中制作静态元素宽度

javascript - 在 ComboBox 的焦点上而不是在键入时发送 Ajax 请求

javascript - 如何获取 ExtJS 存储中记录的预排序索引?

c - 数独网格生成器

java - 如何创建分布式计算系统?

javascript - 我如何更改视口(viewport)区域 extjs 4 的颜色?

javascript - 未捕获的类型错误 : Object #<Object> has no method 'apply' error

image - ExtJS 4:表单字段中的图像?