更改增强网格行颜色背景
我正在尝试更改增强网格中一行的背景颜色。这让我发疯,提前感谢您的宝贵时间。
首先,我选择带有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这个答案
虽然我认为如果您重写 onStyleRow 而不是使用 dojo.connect 您应该将其放在自定义函数的底部:
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: