jqGrid FrozenColumns 改变列样式重置回来

jqGrid FrozenColumns changing Column style Resets back

我已经使用 the answer 中发布的解决方案来更改我的 jqgrid 上的鼠标指针

但我遇到了问题。当列被冻结时,鼠标指针是光标而不是我在代码中设置的默认光标。

我看到它在我的方法中将冻结的列指针更改为默认值,但在某处恢复到其原始状态 css。

当时我写 the answer jqGrid 没有冻结列功能。

如果你会使用 free jqGrid 4.8 (see readme and wiki) then you don't need to do anything. Non-sortable columns have already the correct cursor. See the demo.

如果您确实需要使用旧的 jqGrid 版本,那么您可以执行以下操作

var p = myGrid[0].p, cm = p.colModel,
    $frozenHeaders = $(myGrid[0].grid.fhDiv)
        .find(".ui-jqgrid-htable>thead>tr.ui-jqgrid-labels>th.ui-th-column");

$.each(myGrid[0].grid.headers, function(index, value) {
    var cmi = cm[index], colName = cmi.name;
    if(!cmi.sortable && colName !== "rn" && colName !== "cb" && colName !== "subgrid") {
        $("div.ui-jqgrid-sortable",value.el).css({cursor:"default"});
        $($frozenHeaders[index]).children("div.ui-jqgrid-sortable")
            .css({cursor:"default"});
    }
});

可以找到对应的demo here.