Customizing List, Quick and Show Views display

On the domain view, three views are present to display data:

  • List View: table representation of entity data with configurable paging defaulting to 10 entries per page.
  • Quick View: allows to review information of one or more individual entries, while still observing the List View.
  • Show View: displays individual entry information in a separate page

Each of the views may have its own set of fields. By default, all persistent entity fields of the following types are displayed:

  • Byte
  • Short
  • Integer
  • Long
  • Float
  • Double
  • BigDecimal
  • Date
  • String
  • Boolean
  • Fields associated with other entities (using one of the following annotations:
    @OneToOne
    @OneToMany
    @ManyToOne
    @ManyToMany)
  • File fields:
    • Fields annotated with @Lob annotation
    • Fields annotated with @FileReference LightAdmin annotation

It is possible to narrow down the list of persistent entity fields by explicitly specifying fields to be displayed:

public class BookingAdministration extends AdministrationConfiguration{

	public FieldSetConfigurationUnit listView( final FieldSetConfigurationUnitBuilder fragmentBuilder ) {
		return fragmentBuilder
			.field( "user" ).caption( "Customer" )
			.field( "hotel" ).caption( "Hotel" )
			.field( "smoking" ).caption( "Smoking" )
			.field( "beds" ).caption( "Beds" ).build();
	}

	public FieldSetConfigurationUnit quickView( final FieldSetConfigurationUnitBuilder fragmentBuilder ) {
		return fragmentBuilder
				.field( "checkinDate" ).caption( "Check-In Date" )
				.field( "checkoutDate" ).caption( "Check-Out Date" ).build();
	}

	public FieldSetConfigurationUnit showView( final FieldSetConfigurationUnitBuilder fragmentBuilder ) {
		return fragmentBuilder
				.field( "user" ).caption( "Customer" )
				.field( "hotel" ).caption( "Hotel" )
				.field( "smoking" ).caption( "Smoking" )
				.field( "beds" ).caption( "Beds" )
				.field( "checkinDate" ).caption( "Check-In Date" )
				.field( "checkoutDate" ).caption( "Check-Out Date" ).build();
	}
}
This will produce the following result:
Configurable List View, Quick View and Show View

Along with persistent fields, each of the views can display the following types of fields:

  • Fields with dynamically calculated values, such as fields of an associated entity, results of entity’s methods calls, non-persistent entity fields
  • Fields with custom content based on persistent and associated fields

Displaying Fields Backed by Dynamic Expression

Displaying Fields Rendered in a Custom Way