Angular ag网格,搜索文本不适用于应用的列
网格上应用cellRenderer的列很少。例如,country列实际上有国家代码,但是使用cellrenderer,我将内容处理为countryflag+国家名称。我正在工具提示上显示国家代码。现在,如果我按国家名称搜索,它不会过滤网格,而如果我按国家代码过滤,它会过滤网格。是否有一种方法可以对显示为列内容的实际文本进行筛选 网格选项:Angular ag网格,搜索文本不适用于应用的列,angular,Angular,网格上应用cellRenderer的列很少。例如,country列实际上有国家代码,但是使用cellrenderer,我将内容处理为countryflag+国家名称。我正在工具提示上显示国家代码。现在,如果我按国家名称搜索,它不会过滤网格,而如果我按国家代码过滤,它会过滤网格。是否有一种方法可以对显示为列内容的实际文本进行筛选 网格选项: enableSorting: true, enableFilter: true, enableColResize: true,
enableSorting: true,
enableFilter: true,
enableColResize: true,
enableBrowserTooltips: true,
rowDragManaged: true,
{
headerName: "Country",
field: "COUNTRY",
cellRenderer: this.countryCellRenderer,
tooltipField: "COUNTRY",
},
更新:
将列定义更改如下:
{
headerName: "Country",
field: "COUNTRY",
cellRenderer: this.countryCellRenderer,
getQuickFilterText: function(params) {
return params.value.name;
},
还是不走运
用以下代码解决!!!!!!!:
headerName: "Country",
field: "COUNTRY",
cellRenderer: this.countryCellRenderer,
getQuickFilterText: function (params: any) {
if (params.value.length>2) {return params.value;}
if (params.value.length===2){
const countries = JSON.parse(localStorage.getItem('scanCountries'));
var found = countries.filter(function (countries) { return countries.alpha2_Country_Code == params.value });
return found[0].Country_Name;
}
},
tooltipField: "COUNTRY",
},
是解决了还是您仍在寻找解决方案?已解决并在原始帖子中更新了解决方案…谢谢是解决了还是您仍在寻找解决方案?已解决并在原始帖子中更新了解决方案…谢谢