在 GridPanel Ext.net (ExtJS) 中突出显示一组行
需要以 Ext.net gridPannel
颜色突出显示需要突出显示的行集。
当前的方法是在渲染 GridPannel 时调用以下函数:
function (value, meta, record, rowIndex,columnIndex,store)
{
color= record.data["ColorValue"];
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.cssClass'+rowIndex+' { background color:'+color+'}';
document.getElementsByTagName('head')[0].appendChild(style);
grid.store.getAt(rowIndex).set("mySelected", "cssClass"+rowIndex);
}
但是使用这种方法:它突出显示所有行具有相同的颜色 .. 测试 alert(color);
从 GridPannel 中获取每种颜色的正确不同颜色
有什么好的方法吗?
Required to highlight set of rows in a Ext.net gridPannel
color which required to highlight
Current approach is to call the below function on rendering the GridPannel:
function (value, meta, record, rowIndex,columnIndex,store)
{
color= record.data["ColorValue"];
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.cssClass'+rowIndex+' { background color:'+color+'}';
document.getElementsByTagName('head')[0].appendChild(style);
grid.store.getAt(rowIndex).set("mySelected", "cssClass"+rowIndex);
}
But with this approach: it highlights all the rows with the same color .. a test alert(color);
fetched the correct different color of each color from the GridPannel
Any Good approach for this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以重写 GridView 中的 getRowClass 方法。
或者,如果您需要在渲染后应用颜色,您可以尝试为每一行进行设置:
注意:这个示例基于 ExtJS 3.4 API,但我敢打赌 4.0 中有类似的东西。
You can override getRowClass method in GridView.
Or if you need apply colors post-render, you can try setting for each row:
Note: this examples are based on ExtJS 3.4 API, but i bet there is something similiar in 4.0.
使用 ExtJS 4,您可以使用 突出显示行的 方法元素网格存储中的记录。
With ExtJS 4 you can use the highlight method of the row element of the records in the grid store.