更改行 extjs4 的背景颜色
我有一个名为“grid”的网格,并且加载时有行被插入到网格中。有些行将显示为绿色,则表示已成功输入行,而背景颜色为红色的行将出现错误。我让它在某个时候工作,但错误行将被添加到网格中,其背景色为红色。然后,当我尝试添加新行以输入新数据时,所有行都变成白色。然后就不再一起工作了。我已经尝试过
store.insert(0, r).addClass('error-row');
了
Ext.fly(grid.getView().getRow(0)).addClass('error-row');
,
var cls ='error-row'
addRowClass : function(rowId, cls) {
var row = this.getRow(rowId);
if (row) {
this.fly(row).addClass(cls);
}
}
但
grid.getView().getRowClass = function(record, index, rp ,store) {
return 'error-row';
};
我不确定该怎么做。
CSS
<style>
.error-row .x-grid-cell {
background-color: #990000 !important;
}
.new-row .x-grid-cell {
background-color: #F5F2F3 !important;
}
</style>
I have a grid named 'grid' and onload there are rows being insert into the grid. Some Rows will be in green will be successfully input rows while rows with a background color of red will have errors. I had it working at some point but the error rows would be added to the grid w their background color red. Then when i tried to add a new row to enter new data into that all the rows went white. And then that stopped working all together. I've tried
store.insert(0, r).addClass('error-row');
and
Ext.fly(grid.getView().getRow(0)).addClass('error-row');
and
var cls ='error-row'
addRowClass : function(rowId, cls) {
var row = this.getRow(rowId);
if (row) {
this.fly(row).addClass(cls);
}
}
and
grid.getView().getRowClass = function(record, index, rp ,store) {
return 'error-row';
};
I'm unsure of what to do.
css
<style>
.error-row .x-grid-cell {
background-color: #990000 !important;
}
.new-row .x-grid-cell {
background-color: #F5F2F3 !important;
}
</style>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
viewConfig 属性应该为您指明正确的方向 - 使用 Ext 网格示例中的代码,添加:
代码如下所示:
The viewConfig property should point you in the right direction - using code from Ext's sample for grid, adding:
The code looks like this: