gpt4 book ai didi

javascript - 使用 setLabel 方法将 CSS 应用于卡住列的标题

转载 作者:行者123 更新时间:2023-12-03 07:26:01 25 4
gpt4 key购买 nike

我正在尝试使用以下代码为 jqgrid 中的标题应用背景颜色:

$("#" + gridId).jqGrid("setLabel", "Action", "Website", { "background": "red" });

它可以工作,但是如果列卡住了,它就无法工作。请帮忙。

最佳答案

jqGrid 4.6.0 中卡住列的实现存在错误。实现您的要求的最简单方法:升级到free jqGrid 4.13.1 并使用 colModellabelClasses 属性(请参阅 the demo )。在列标题上设置 CSS 将是最小的问题。免费的 jqGrid 是在与 jqGrid 4.6 相同的许可证 (MIT/GPLv2) 下提供的。

只有当您当前确实无法更新到免费的 jqGrid 时,您才必须手动设置列标题的 CS 样式。相应的代码可能是这样的

var $grid = $("#" + gridId);
$($grid[0].grid.hDiv)
.find("tr.ui-jqgrid-labels th")
.eq(pos)
.add(
$($grid[0].grid.fhDiv)
.find("tr.ui-jqgrid-labels th")
.eq(pos))
.css({ background: "red" });

其中 pos 是列的索引。

要使用columnChooser,您应该包含ui.multiselect.cssjquery-ui.min.jsui.multiselect .js。您将在 plugins 中找到 ui.multiselect.* jqGrid 的子目录。

关于javascript - 使用 setLabel 方法将 CSS 应用于卡住列的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36004355/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com