List Component
Class Name
The List Component is implemented by the following class:
org.onehippo.cms7.essentials.components.EssentialsListComponent
Overview
The List Component executes queries on documents stored in the repository and exposes the results to the rendering template. You can configure the query using component parameters to match your requirements.
You can extend this component to customize query logic. The Essentials News Component and Essentials Event Component are examples of specialized list components built on top of the List Component.
The component supports pagination. Results are provided as a pageable object, which includes the page size and current page number.
You can use the List Component with facet navigation by specifying a facet navigation node in the path parameter. Customized queries may not always be compatible with facet navigation.
Component Parameters
| Name | Description |
|---|---|
| path | Repository path to a folder or facet navigation node, relative to the site root folder. This determines the scope (queried repository sub-tree) of the query. If not set or empty, the component uses the repository node identified by the current request URL and site map as the scope. |
| documentTypes | Comma-separated list of JCR primary node types to search. Refer to your available CNDs for valid values. If not specified, the query is not restricted by node type. |
| includeSubtypes | Indicates whether sub-types of the specified document types should be included. This flag is currently unused; sub-types are always included. |
| query | Free-text query string. The fields searched depend on your indexing configuration. This parameter can be overridden by a request parameter. |
| sortField | Name of the repository node attribute to sort results by. Check the document type's bean or the CMS Document Type Editor for valid values. When searching multiple document types, use an attribute common to all. This parameter has no effect if the query scope is a faceted navigation node. |
| sortOrder | Sorting order: "desc" or "asc". Defaults to descending. This parameter has no effect if the query scope is a faceted navigation node. |
| page | 1-based integer for the requested page. Defaults to 1 if not specified. Can be overridden by a request parameter. |
| pageSize | Maximum number of results per page. Defaults to 10. |
| showPagination | Indicates whether the rendering template should display pagination controls. The component passes this value through to the template. |
Request Parameters
| Name | Description |
|---|---|
| query | Free-text query string. Does not work when the query scope is a facet navigation node. Overrides the component parameter. |
| page | 1-based integer for the requested page. Defaults to 1 if not specified. Overrides the component parameter. |
Rendering Attributes
| Name | Type | Description |
|---|---|---|
| query | java.lang.String | Normalized free-text query string from the request or component parameter. |
| pageable | org.onehippo.cms7.essentials.components.paging.Pageable | Pageable collection of HippoBeans for the requested page. The collection also provides the page size and current page number. May be null if the query execution fails. |