我有autoGroupColumnDef
,我想设置文字过滤器。但该列的值来自getDataPath
方法。但我需要在过滤器中使用另一个值。
autoGroupColumnDef: {
headerName: "Systems",
filter: 'text',
valueGetter: function(params) {
var result = params.data.hospName || params.data.hospitalSystem;
return result;
},
cellRendererParams: {
suppressCount: true,
innerRenderer: function(params) {
var result = params.data.hospName || params.data.hospitalSystem;
return result;
}
}
},
答案 0 :(得分:0)
尝试了几件事后,
选项1:您可以使用[filterParams][1]
。这只有助于在filterMenu中使用选项/选项..
function filterCellRenderer(params) {
//other than params.value nothing else will be there..
// params.data won't be there when its called from filter popup
return params.value+" Custom";
}
var gridOptions= {
...,
treeData: true,
components: {
...,
filterCellRenderer: filterCellRenderer
},
autoGroupColumnDef: {
...,
filterParams: {
cellRenderer: 'filterCellRenderer',
//values: ["A", "XYZ"] //you can feed directly specific values. These need to be part of filePath. Else filtering won't work.
}
}
}
选项2:如果您正在寻找自定义过滤器(使用GUI进行调整),或者您希望在通过ag-grid配置后进行处理,则可以定义以下内容:
var gridOptions = {
...
getMainMenuItems: getMainMenuItems,// function to build your own menu
postProcessPopup: function(params){
// edit the popup..
//params.type gives whether its column menu or not.
//params.ePopup gives handler to popup which you can modifiy.
},
...
}
或您可以按照here
所述构建自己的自定义过滤器