0
votes

I want to allow users to filter a grid, and then save the filtering options they have chosen so they can then use that filter subsequently.

I am able to extract the current filter data by using

optionObject.api.getFilterInstance(field_name_for_column);

I see different values in the returned object based on whether the column is a text column, a number column or a date column.

The text columns seem to use filterText and filterConditionText for the 2 allowed filter values.

The number columns seem to use filterNumber, filterNumberTo, filterNumberCondition and filterNumberConditionTo for the allowed filters, where the "To" values are used for range checks.

The date columns seem to have the same sort of setup (dateFrom, dateTo, dateConditionFrom, dateConditionTo) as the numbers.

However, when I print the values, dateFromCondition and dateToCondition seem to have the values from dateFrom and dateTo.

For example, if I do 2 date ranges:

01/01/2004 to 02/01/2004 OR
02/01/2004 to 03/01/2004

The values returned in the filter are:

dateFrom = 01/01/2004
dateTo = 02/01/2004
dateFromCondtion = 01/01/2004
dateToCondition = 02/01/2004

Am I misunderstanding how these values are intended to be used? Or is this a known issue in ag-grid?

I am using the standard agDateColumnFilter setting for filter and have provided a dateFilter routine to do the comparator (per the documentation).

1

1 Answers

0
votes

Am I misunderstanding how these values are intended to be used? Or is this a known issue in ag-grid?

ConditionalFilter - configured via getFilterInstance and setModel functions, so - you are be able to retrieve conditionalValue from filter instance.

let dateFilterInstance = this.gridApi.getFilterInstance("yourDateField");
console.log(dateFilterInstance.conditionValue);