jqgrid自定义行颜色

发布于 2024-08-12 04:12:02 字数 39 浏览 1 评论 0原文

如何使用自定义格式化程序设置整行(而不仅仅是单元格)的背景颜色?

How can I set the background-color of an entire row (not just cell) using the custom formatter?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

软的没边 2024-08-19 04:12:02

自定义格式化程序用于格式化单元格的数据(= 文本)。据我所知,他们不知道实际的单元格(意思是 jquery 对象),但只知道它的值。

但通常 jqGrid 会为所有行分配 ID,因此如果您知道行 ID,则设置背景颜色应该只需设置该行的所有 td 子元素的背景颜色即可。

$(rowid).children("td").css('background-color', "#5E5E5E");

The custom formatters are used for formatting the cell's data (= text). As far as I know they don't know about the actual cell (meaning a jquery object) but only of it's value.

But usually jqGrid assigns IDs to all rows so setting the background color if you know the rows ID should be only a matter of setting the background color of all td child elements of this row.

$(rowid).children("td").css('background-color', "#5E5E5E");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文