Listing (element child of entity)
Listings are used for showing the existing database records for an entity.
Every entity generates a default listing and may create as many custom listings as needed. A listing may define the columns, filters, actions and actiongroups to be shown, the view and subset used, and some more details described below.
Listings are composed visually by three sections: filters, view and actionbar.
- filters section contains all the specified filters, and is by default placed on top of the view.
- view section displays results in a certain way. The default view is called 'table', where results are shown as a table, with the defined properties as columns. Each row is a valid result of the query.
- actionbar section includes paging toolbar, custom actions and system default actions (Add and Remove actions).
Both the filters and the actionbar sections modify the results shown in the view. They define user parameters that restrict the query. These parameters could be filter values, a page selection (e.g., results from the 51st to the 100th) or just the addition or removal of a record.
The layout attribute indicates how to display filters in a listing. It modifies the position of the elements of a listing (filters on top, listings below; filters on the left, listings on the right).
The view attribute is used to set the way the records should be listed. This attribute may take one of these built in values: table (default), basic or thumbnails. It may also use views created by the developer or imported from the JRapid Community. Defining a new listing view is done by replacing the view section with a custom one, where results are presented in a specific way.
The subset attribute indicates a subset element to be used for showing only those records that fulfill a specified criterion, to define the properties for each record that must be retrieved from the database or to change the order of the resulting records.
Listing elements may define tab elements as children. This creates tabs for different view sections in a listing.
A displayproperties attribute may be used to define the properties that will be displayed in the listing, such as the columns in a table view.
The mainaction attribute overrides the default behavior on each view to open the record (in view 'table', the double-click, in 'basic' the single click, etc).
See the defaultlisting attribute of entity to learn how to change the default listing.
<entity ... <listing name = NAME layout = "simple" | "left" view = COMMA_SEPARATED_VIEWS subset = SUBSET displayproperties = COMMA_SEPARATED_PROPERTIES displayfilters = COMMA_SEPARATED_FILTERS displayactions = COMMA_SEPARATED_ACTIONS displayactiongroups = COMMA_SEPARATED_ACTIONGROUPS mainaction = ACTION_NAME noadd = "noadd" noremove = "noremove" > [ Contents: tab* ] </listing> </entity>
This simple example makes use of several possible tweaks for listings. Note the custom listing companyListing that uses the forCompanyListing subset to change the properties that should be displayed.
Two filters, by name and active, are created, and an extra action is defined.
When you open the companyListing this is what you get.