【发布时间】:2021-12-05 11:14:26
【问题描述】:
我正在使用 getRowStyle 函数,但它似乎只在加载或编辑网格时运行一次。如何手动强制运行此功能以便加载行颜色。
conditonalFormatter() {
this.GridRef.rowConditionalFormatting('red', this.rowFormatData);
}
rowConditionalFormatting(rowColor, rowFormatData) {
this.rowFormatData = rowFormatData;
this.getRowStyle = params => {
for (let i = 0; i < this.rowFormatData.length; i++) {
const columnHeader = this.rowFormatData[i].Name;
const operator = this.rowFormatData[i].Operator;
const cellValue = this.rowFormatData[i].Value;
if (params.data[columnHeader] == cellValue) {
return {background: rowColor };
}
}
}
}
【问题讨论】:
-
请提供Minimal, Reproducible Example,否则我们不知道您已经尝试过什么。
-
@Batajus - 请参考 abv 函数。它在加载时工作,但如果我从其他地方调用这个函数,那么 this.getRowStye 将不会被调用。
-
你能不能也分享一下你调用的代码sn-ps
this.getRowStyle -
@Batajus 我使用引用从差异组件中调用了它。谢谢。
-
你试过
rowClassRules吗?
标签: angular angular7 ag-grid ag-grid-angular