Configuring Filters

By default, filters are not displayed on the domain view. Filtering is enabled when FiltersConfigurationUnit is added to the entity configuration as described in the examples below.

Exact match search rule is used for all fields except text fields, where case sensitive partial search is used.

In order for filtering to work with associated fields, class of the associated entity should override equals() and hashCode() methods.

Below are two ways to add fields to the filters unit which will produce the same result.

...
public class BookingAdministration extends AdministrationConfiguration<Booking>{

	public FiltersConfigurationUnit filters( final FiltersConfigurationUnitBuilder filterBuilder ) {
		return filterBuilder
			.filter( "Customer", "user" )
			.filter( "Booked Hotel", "hotel" )
			.filter( "Check-In Date", "checkinDate" )
			.filter( "Check-Out Date", "checkoutDate" )
			.filter( "Smoking", "smoking" ).build();
	}

}

 

...
public class BookingAdministration extends AdministrationConfiguration<Booking>{

	public static FiltersConfigurationUnit filters( final FiltersConfigurationUnitBuilder filterBuilder ) {
		return filterBuilder.filters(
				filter().field( "id" ).caption( "Identifier" ).build(),
				filter().field( "textField" ).caption( "The Text Field" ).build(),
				filter().field( "integerField" ).caption( "The Integer Field" ).build(),
				filter().field( "primitiveIntegerField" ).caption( "The Primitive Integer Field" ).build(),
				filter().field( "decimalField" ).caption( "The Decimal Field" ).build(),
				filter().field( "booleanField" ).caption( "The Boolean Field" ).build()
		).build();
}

Filter