首页 > 解决方案 > 表格布局固定在 html 表格上不起作用

问题描述

我想让所有单元格都具有相同的widtd。我正在使用 jsgrid 默认的 table-layout:fixed 但没有任何反应。

list_activity.jsGrid({
 height: "90%",
        inserting: false,
        editing: false,
        filtering: false,
        width: "100%",
        paging: true,
        autoload: true,
        pageSize: 4,
        data: [],
})

https://jsfiddle.net/marklibres345/vydhe714/17/

标签: jquerytwitter-bootstrapjsgrid

解决方案


定义每个 colModel

$("#grid").jqGrid({
    datatype: "local",
    height: 250,
    colNames: ['Inv No', 'Thingy', 'Blank', 'Number', 'Status'],
    colModel: [{
        name: 'id',
        index: 'id',
        width: 60,
        sorttype: "int"},
    {
        name: 'thingy',
        index: 'thingy',
        width: 60,
        sorttype: "date"},
    {
        name: 'blank',
        index: 'blank',
        width: 60},
    {
        name: 'number',
        index: 'number',
        width: 60,
        sorttype: "float"},
    {
        name: 'status',
        index: 'status',
        width: 60,
        sorttype: "float"}
    ],
    caption: "Stack Overflow Example",
    // ondblClickRow: function(rowid,iRow,iCol,e){alert('double clicked');}
});


推荐阅读