更改增强网格行颜色背景

发布于 2025-01-05 01:58:13 字数 749 浏览 2 评论 0原文

我正在尝试更改增强网格中一行的背景颜色。这让我发疯,提前感谢您的宝贵时间。

首先,我选择带有 onRowClick 事件的行。

      function onRowClickHandler(evt) {
             selectedRow = evt.rowIndex;
             selectedCode = dijit.byId("myGrid").getItem(evt.rowIndex).code;
      }

我需要仅当单击某个按钮时背景颜色才会改变。

        dijit.byId("myGrid").getRowNode(selectedRow).style+="backgroungColor:red;");

        dijit.byId("myGrid").getRowNode(selectedRow).customStyle+="backgroungColor:red;");

这不起作用。

我也尝试过 onStyleRow 但它不起作用。

我尝试过

    dojo.style(dijit.byId("myGrid").getRowNode(selectedRow), "backgroundColor", "#454545" )

但风格并没有保持固定。

谢谢!

I'm trying to change the background color for a row in a enhancedGrid. This is driving me crazy, thank you in advance for your time.

First, I select the row with onRowClick event.

      function onRowClickHandler(evt) {
             selectedRow = evt.rowIndex;
             selectedCode = dijit.byId("myGrid").getItem(evt.rowIndex).code;
      }

I need that the background color changes only when acertain button is clicked.

        dijit.byId("myGrid").getRowNode(selectedRow).style+="backgroungColor:red;");

or

        dijit.byId("myGrid").getRowNode(selectedRow).customStyle+="backgroungColor:red;");

This doesn't work.

I also tried with onStyleRow but it doesn't work.

I've tried with

    dojo.style(dijit.byId("myGrid").getRowNode(selectedRow), "backgroundColor", "#454545" )

But the style does not remain fixed.

Thanks!

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

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

发布评论

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

评论(1

鹤仙姿 2025-01-12 01:58:13

看看这个答案

虽然我认为如果您重写 onStyleRow 而不是使用 dojo.connect 您应该将其放在自定义函数的底部:

dojox.grid.EnhancedGrid.prototype.onStyleRow.apply(this, arguments);

Take a look at this answer

Though I think if you override onStyleRow instead of using dojo.connect you should have this at the bottom of your custom function:

dojox.grid.EnhancedGrid.prototype.onStyleRow.apply(this, arguments);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文