在 ag-Grid 中,当我更改行背景时,所选行没有颜色(默认为蓝色)
In ag-Grid when I change the row background, there is no color for selected row (blue by default)
在 ag-Grid 中,当我更改行背景颜色时,它工作正常,但是当我 select 该行时,颜色没有变为蓝色,所以我可以识别该行是 selected。
我正在使用 gridOptions.getRowStyle 更改行背景颜色:
gridOptions.getRowStyle = function(params) {
return { background: "#3a3a3a" }
}
如果要更改所选行的样式,请使用 css
中的 class
.ag-row-selected {
background-color: black;
color: white ;
border-color: gray;
}
我采用的方法是在 ag-grid 中使用 rowClass 选项。
rowClass: 'my-row'
然后在您的 css 中您可以定义:
.ag-root .my-row:not(.ag-row-selected) {
background-color: #3a3a3a;
}
https://embed.plnkr.co/fTENsl/
另一个选项,如果你想要自定义选择的颜色,可以使用这个:
.ag-root .my-row {
background-color: #3a3a3a;
}
.ag-root .my-row.ag-row-selected {
background-color: blue;
}
在 ag-Grid 中,当我更改行背景颜色时,它工作正常,但是当我 select 该行时,颜色没有变为蓝色,所以我可以识别该行是 selected。
我正在使用 gridOptions.getRowStyle 更改行背景颜色:
gridOptions.getRowStyle = function(params) {
return { background: "#3a3a3a" }
}
如果要更改所选行的样式,请使用 css
中的 class.ag-row-selected {
background-color: black;
color: white ;
border-color: gray;
}
我采用的方法是在 ag-grid 中使用 rowClass 选项。
rowClass: 'my-row'
然后在您的 css 中您可以定义:
.ag-root .my-row:not(.ag-row-selected) {
background-color: #3a3a3a;
}
https://embed.plnkr.co/fTENsl/
另一个选项,如果你想要自定义选择的颜色,可以使用这个:
.ag-root .my-row {
background-color: #3a3a3a;
}
.ag-root .my-row.ag-row-selected {
background-color: blue;
}