如何在该特定列的标题单元格内显示您正在过滤列的短语?
假设我按“USA”过滤Country列,标题单元格更改为Country(USA)。
我尝试使用角度检查器检查范围,但找不到与确切过滤短语相关的任何内容。
答案 0 :(得分:1)
当您定义列定义而不是使用静态值设置headerName
时,可以设置headerValueGetter
属性以便计算标题值
例如:
{ headerName: "Country", field: "country", editable: true, filter: 'text' }
变为
{ headerValueGetter : (params) => {return "Country" + FILTER_VALUE}, field: "country", editable: true, filter: 'text' }
据说你可以根据需要更新标题......
var countryCol = gridOptions.columnApi.getColumn("country").getColDef();
colDef.headerName = "Country (USA)";
gridOptions.api.refreshHeader();