我是DoJo开发的新手,所以这可能是基本的
我创建了一个EnhancedDatagrid,它可以很好地显示数据
数据来自不同页面中的JSON存储
我有一个按钮,导致在数据存储区中创建一个新条目,然后我的数据网格被“刷新”。这很好。
但现在我只想作为改变数据网格中第一行样式的最后一步。
(我需要让新添加的行更明显。)
但我根本无法弄清楚如何获取数据网格中第一行的句柄。
...
grid = new dojox.grid.EnhancedGrid({
id:strId,
商店:商店,
结构:布局,
},document.createElement('div'));
dojo.byId(占位符).appendChild(grid.domNode);
grid.startup();
var row = grid.getItem(0); // ---获得第一行。怎么样 ?如何应用新风格?
...
提前谢谢你。
答案 0 :(得分:5)
解决了这样的问题:
dojo.connect(grid, 'onStyleRow', this, function (row) {
var item = grid.getItem(row.index);
if (row.index == 0) {
row.customClasses = "highlightRow";
row.customStyles += 'background-color:#FFB93F;';
}
});
我使用'Claro'主题,它阻止我设置行单元格的背景颜色。 解决方案是将customClasses设置为这样的样式:
.highlightRow tr
{
background-color: #FF6A00 !important;
}
在此处找到解决方案的一部分:http://dojo-toolkit.33424.n3.nabble.com/row-customStyles-was-overwrite-by-claro-theme-td3763079.html