Posted 12 July 2021, 7:55 am EST
Hi,
To implement the above requirement, we may perform the following:
-
"* “We may make use of the editingFilter event of FlexGrid filter which occurs when a column filter is about to be edited by the user.”
-
“To get the filter for a given column, we may make use of getColumnFilter() of FlexGird filter which gets the filter for a given column.”
-
“We may use the getUniqueValues() method of valueFilter to get an array containing objects representing all unique values for this column.”
-
“We may perform the required manipulation and assign the final array to the uniqueValues property of ValeuFilter.”
"
Please refer to the code snippet:
filterEditing(grid, filter, e) {
if (grid.columns[e.col].binding == 'subjects') {
let valueFilter = filter.getColumnFilter('subjects', true).valueFilter;
let customUniqueValues = [];
valueFilter.getUniqueValues().forEach(item => {
if (item.value.indexOf('english') >= 0) {
if (item.value.length > 1) {
let str = item.text;
str = str.replace('english', '');
customUniqueValues.push(str);
}
} else {
customUniqueValues.push(item.text);
}
});
valueFilter.uniqueValues = customUniqueValues;
}
}
Sample: https://stackblitz.com/edit/angular-tykcmw
Regards,
Ashwin