JqG​​rid设置列宽不起作用

时间:2016-07-27 10:19:24

标签: javascript jquery css jqgrid

我正在尝试使用JqGrid实现网格。

我无法将列宽与标题宽度对齐因为列数据太大而无法容纳。如果列值超过标题宽度,是否可以隐藏列值。以下是我的代码段。

    $("#tblscheduleScan").jqGrid({
data: data,
datatype: 'local',
width: 1025,
colNames: ['Chosen Repo', 'Protex Project Name', 'Next Scheduled Scan', 'Recurrence Pattern', 'Modify'],
colModel: [{
  name: 'scannedPath',
  shrinkToFit: false
}, {
  name: 'projectName',
  shrinkToFit: false
}, {
  name: 'nextScanDate',
  shrinkToFit: false
}, {
  name: 'scheduleType',
  shrinkToFit: false
}, {
  name: 'Modify',
  align: 'center',
  classes: 'clickGridLink',
  shrinkToFit: false
}],
sortname: 'projectName',
viewrecords: true,
sortorder: "asc",
caption: '<h3>Scan Schedules</h3>',
height: 'auto',
gridview: true,
autoencode: true,
onCellSelect: function(rowid, iRow, iCol, e) {
  //var rowData = $(this).jqGrid("getRowData", rowid);
  if (iCol === 'Edit') {
    modifyScheduleScan(data[rowid - 1]);

  }
}


});

enter image description here

如果我尝试手动设置宽度,则无法在Google Chrome浏览器中使用,但在Firefox中可以正常工作。

colModel: [
                                {name: 'scannedPath', width: 50, shrinkToFit: false},
                                {name: 'projectName', width: 95, shrinkToFit: false},
                                {name: 'nextScanDate', width: 30, shrinkToFit: false},
                                {name: 'scheduleType', width: 27, shrinkToFit: false},
                                {name: 'Modify', align: 'center', classes: 'clickGridLink', width: 10, shrinkToFit: false}
                            ]

0 个答案:

没有答案