Skip to main content

Date Filter

Date Filters allow you to filter date data.

Using Date Filter

Date filter is represented by class AgDateColumnFilter.

ColDef colDef = ColDef.builder()
.field("birthDate")
.filter(new AgDateColumnFilter())
.build()

Date Filter Parameters

Date Filters are configured though the filter params (DateFilterParams class)

PropertyTypeDefaultDescription
inRangeInclusivebooleanfalseIf true, the 'inRange' filter option will include values equal to the start and end of the range.
includeBlanksInEqualsbooleanfalseIf true, blank (null) values will pass the 'equals' filter option.
includeBlanksInNotEqualbooleanfalseIf true, blank (null) values will pass the 'notEqual' filter option.
includeBlanksInLessThanbooleanfalseIf true, blank (null) values will pass the 'lessThan' and 'lessThanOrEqual' filter options.
includeBlanksInGreaterThanbooleanfalseIf true, blank (null) values will pass the 'greaterThan' and 'greaterThanOrEqual' filter options.
includeBlanksInRangebooleanfalseIf true, blank (null) values will pass the 'inRange' filter option.
maxValidDateLocalDate-The maximum valid date that can be entered in the filter. If set, this will override maxValidYear - the maximum valid year setting.
maxValidYearInteger-This is the maximum year that may be entered in a date field for the value to be considered valid.
minValidDateLocalDate-The minimum valid date that can be entered in the filter. If set, this will override minValidYear - the minimum valid year setting.
minValidYearInteger1000This is the minimum year that may be entered in a date field for the value to be considered valid.

Example of using filter parameters.

ColDef colDef = ColDef.builder()
.field("birthDate")
.filter(new AgDateColumnFilter()
.filterParams(
DateFilterParams.builder()
.inRangeInclusive(true)
.includeBlanksInEquals(true)
.includeBlanksInNotEqual(true)
.includeBlanksInLessThan(true)
.includeBlanksInGreaterThan(true)
.includeBlanksInRange(true)
.maxValidDate(LocalDate.of(2030, Month.DECEMBER, 31))
.minValidYear(1970)
.build()
)
)
.build()

Date Filter Model

Date filter model is represented by DateFilterModel class.

If more than one Filter Condition is set, then multiple instances of the model are created and wrapped inside a Combined Model (CombinedSimpleModel<DateFilterModel>).

Grid using Server Side Date Filter

  • On column Birth Date, inRangeInclusive, includeBlanksInEquals, includeBlanksInNotEqual, includeBlanksInLessThan, includeBlanksInGreaterThan, includeBlanksInRange are all set to true
  • minValidYear is current - 1 and maxValidYear is current + 1
  • Backend source code available here