如何在免费的 jqgrid 中调整操作列的大小

How to resize actions column in free jqgrid

有时包含内联编辑按钮的列的宽度太小。 它的宽度不能用鼠标改变。

例如,从

打开演示

http://www.ok-soft-gmbh.com/jqGrid/OK/RemovePageHorizontalScrollbar2.htm

并尝试通过拖动 header 中的右边框来调整操作或数字列的大小。列宽不变。

如何解决此问题以便用户也可以更改操作和数字列宽?

引用的示例包含定义为

的列
{ name: "act", template: "actions", width: 66 }

act列的width是固定的,是66px。模板 actions 将定义如下(参见代码 the line):

actions: function () {
    return {
        formatter: "actions",
        width: (this.p != null && this.p.fontAwesomeIcons ? 33 : 37) + (jgrid.cellWidth() ? 5 : 0),
        align: "center",
        label: "",
        autoResizable: false,
        frozen: true,
        fixed: true,
        hidedlg: true,
        resizable: false,
        sortable: false,
        search: false,
        editable: false,
        viewable: false
    };
}

您可以看到它包含 fixed: true, resizable: false 属性。如果要更改属性,只需在列定义中重新定义模板的值即可:

{ name: "act", template: "actions", width: 66, fixed: false, resizable: true }