"records" Macro

Last modified by Pierre Jeanjean on 2026/11/24 15:58

Reference

Description

XWiki 18.10.0+ Displays the entries of an object type, the Objects of one Class, as a Live Data table that readers can sort and filter, and edit if the author allows it.

The Macro is a block Macro and takes no content.

Usage

Only class is mandatory. Without properties, the table displays the title of the entries followed by every field of the object type:

{{records
  class="..."
  properties="..."
  filters="..."
  sort="..."
/}}

The properties, filters and sort parameters take the same values as their "liveData" Macro counterparts. When a parameter names something the table cannot use, a warning above the table says so:

ProblemWhat the table does
A field no longer exists in the object typeSkips the column, the filter or the sort on it.
A field cannot be filtered or sorted onIgnores the filter, or the sort on it; the warning says what the table is sorted on instead.
A filter value does not fit the type of its field, or a filter cannot be readIgnores the filter.
The creation strategy is not installed, or needs a column the table does not displayDoes not let readers add entries.
The object type no longer existsDisplays an error instead of the table, and leaves the Macro call unchanged.

Parameters

NameMandatoryAllowed ValuesDefault ValueDescription
classYesThe reference of a Class PageN/A"Object type": the Class whose Objects are listed.
propertiesNoA comma-separated list of field names and page metadata, such as doc.title or doc.dateThe title, then every field of the object type"Columns": the columns to display, in order.
filtersNoA URL query string of field=value pairsN/A"Filters": the filters applied before readers see the table.
sortNoColumns, each optionally suffixed with :asc or :descThe first column, when it can be sorted on"Sort": the columns the table is sorted on when the Page opens, in order of precedence.
layoutsNotable, cards, or both, comma-separatedtable"Layout": how the entries are laid out, as described in Live Data Layouts. The dialog offers one of the two; with both, readers can switch between them.
descriptionNoAny textN/A"Description": shown above the table, and used as its accessible description.
allowEditModeNotrue or falsefalse"Allow edit mode": lets readers switch the table to Edit mode, where they can change the entries they can edit.
creationStrategyNouuid, title, templateProvider, or the hint of another row naming strategyN/A: readers cannot add entries"Creation strategy": how the Pages of the entries added from the table are named. Requires allowEditMode. title and templateProvider also require the doc.title column.
newEntriesLocationNoThe reference of a spaceThe space of the Page holding the table: under it if it is a nested Page, next to it if it is a terminal Page"New entries location": where the entries added from the table are created. With the templateProvider creation strategy, the first space the template provider restricts creation to is used instead.
templateProviderNoThe reference of a template provider, or XWiki.NoTemplateProvider for noneThe template provider named after the object type, as AppWithinMinutes names them: e.g., Library.Code.BookTemplateProvider for Library.Code.BookClass"Template": the template provider whose template the entries added from the table start from.
idNoAny name unique in the PageA generated identifier"Table identifier", among the advanced parameters: needed only when one Page holds several tables.

Examples

Listing Books, Sorted by Year

{{records
  class="Library.Code.BookClass"
  properties="doc.title,author,year"
  sort="year:desc"
/}}

Listing the Books Not Read Yet

The status field is filtered on two of its values.

{{records
  class="Library.Code.BookClass"
  properties="doc.title,author,status"
  filters="status=To%20read&status=Reading"
  description="Books we have not finished yet."
/}}

Letting Readers Add Books

Readers can switch the table to Edit mode and add books, created in Library.Books and named after their title.

{{records
  class="Library.Code.BookClass"
  properties="doc.title,author,genre,status"
  allowEditMode="true"
  creationStrategy="title"
  newEntriesLocation="Library.Books"
/}}

FAQ

Why can readers not add entries?

Adding entries requires allowEditMode="true", and the reader needs edit right on the location of new entries, otherwise the table offers no way to add one.

Related

Get Connected