Live Data Sources

Last modified by superadmin on 2026/11/25 21:42

The sources a Live Data can read its entries from, the hint naming each one, and the parameters each one accepts.

Reference

A Live Data source provides both the entries and what the Live Data needs in order to interact with them: which properties exist, which of them can be sorted, filtered or edited, and how each is displayed. The source Macro parameter names one by its Component hint, and sourceParameters carries the query string that source understands.

SourceHintEntries come from
Live Table resultsliveTableAny live table results page, which makes an existing live table usable as a Live Data
In-line dataN/AThe Macro content itself, written as JSON

Implementing a new source is described in Live Data Extension Points.

Live Table Source

The liveTable source exposes any live table results page as a Live Data. Adding useLiveData=true to the query string of a page holding a live table previews it as a Live Data without changing the page.

It accepts these live table parameters:

NameDefault ValueDescription
classNameN/AThe class whose objects are listed. Its properties become the properties of the entries.
resultPageXWiki.LiveTableResultsThe page producing the results.
queryFilterscurrentlanguage,hiddenThe query filters applied. With the default value the content is translated to the locale of the reader, and hidden pages are listed only for readers whose profile sets "Display hidden pages" to "Yes".
translationPrefixN/AThe prefix of the translation keys used for the property names.
templateN/AUse this in case you have a live table with results generated from a Velocity template. The value of this parameter should match the template specified in the url live table configuration using the xpage query string.
hasEditModefalseXWiki 18.7.0+ Whether the reader may switch the Live Data to Edit mode.
newRowLocationN/AXWiki 18.7.0+ Location to store pages when creating new rows. Requires a compatible row naming strategy, e.g., uuid.
newRowNamingStrategyN/AXWiki 18.7.0+ How the pages of new rows are named, among the Row Naming Strategies. Rows can be added only when it is set and hasEditMode is true.
newRowTemplateProviderThe template provider named after className, as AppWithinMinutes names them: Space.BookTemplateProvider for Space.BookClassXWiki 18.10.0+ The template provider whose template new rows start from, whatever the strategy: the values given in the row are applied on top of the template. XWiki.NoTemplateProvider creates new rows without a template. A template provider or a template the reader cannot view is ignored.

The extraParams live table parameter is deliberately unsupported: its main use is filtering, and a Live Data expresses filters generically. Migrate a Live Table to Live Data says what to do with it. A live table that built its parameters in Velocity, as in:

{{velocity}}
#set ($options = {
  'className': 'ExtensionCode.ExtensionVersionClass',
  'location': "${doc.space}"
})

{{liveData
  id="versions"
  properties="version,notes"
  source="liveTable"
  sourceParameters="$services.rendering.escape($escapetool.url($options), 'xwiki/2.1')"
/}}
{{/velocity}}

passes them to the source the same way, once URL-encoded and escaped for the wiki syntax.

Row Naming Strategies

XWiki 18.7.0+

The newRowNamingStrategy parameter takes one of these values, or the hint of a custom strategy:

ValuePage nameLocation
uuidA random UUIDnewRowLocation
titleXWiki 18.10.0+ The title given in the new row, transformed by the name strategy of the wiki when it transforms names. When a page with that name exists, the first free suffix among -1, -2, and so on, is appended.newRowLocation
templateProviderXWiki 18.10.0+ Like title, as a terminal or nested page following the "Terminal Page" field of the template provider.The first of the template provider's "Creation Restrictions". Without one, newRowLocation.

XWiki 18.10.0+ With title and templateProvider, the Live Data must display the doc.title property, which Edit mode marks "(Required)".

Properties from Other Classes

XWiki 18.0.0+

It is possible to specify a property from another class than the one named in className by passing a <property>_class source parameter, and it can then be filtered, sorted and edited like any other. When a displayed page holds no object of that class yet, one is created the first time the property is saved.

{{liveData properties="doc.location,doc.title,tags" source="liveTable" sourceParameters="tags_class=XWiki.TagClass&translationPrefix=platform.index."/}}

In-line Data

The entries are written directly in the Macro content as JSON, together with the property descriptors saying how to display them. No source is named in that case.

{{liveData
  id="movies"
  properties="title,genre,releaseDate,director"
}}{
  "data": {
    "count": 2,
    "entries": [
      {
        "title": "Meet John Doe",
        "url": "https://www.imdb.com/title/tt0033891/",
        "genre": ["Comedy", "Romance"],
        "releaseDate": -904615200,
        "director": "Frank Capra",
        "directorURL": "https://www.imdb.com/name/nm0001008/"
      },
      {
        "title": "Modern Times",
        "url": "https://www.imdb.com/title/tt0027977/",
        "genre": ["Comedy", "Drama"],
        "releaseDate": -1068256800,
        "director": "Charlie Chaplin",
        "directorURL": "https://www.imdb.com/name/nm0000122/"
      }
    ]
  },
  "meta": {
    "propertyDescriptors": [
      {"id": "title", "name": "Title", "visible": true, "displayer": {"id": "link", "propertyHref": "url"}},
      {"id": "genre", "name": "Genre", "visible": true},
      {"id": "releaseDate", "name": "Release Date", "visible": true, "displayer": "date"},
      {"id": "director", "name": "Director", "visible": true, "displayer": {"id": "link", "propertyHref": "directorURL"}}
    ]
  }
}{{/liveData}}
Warning

Please note that In-Line Data currently does not support filtering, sorting, or pagination. Therefore, it is recommended to deactivate these features to avoid unexpected error messages when the table Topbar and the Bottombar is used. While filtering and sorting are disabled by default if not set, pagination must be explicitly disabled in the "meta" section of the JSON configuration:

"pagination": {
  "showEntryRange": false,
  "showNextPrevious": false,
  "showFirstLast": false
}

If you want to avoid also displaying the remaining and buggy Page Counter or hide the entire Topbar/Bottombar without disabling pagination in the JSON configuration, you can achieve this using a XWiki.StyleSheetExtension for that specific page, as documented in the Skin Extension Tutorial:
.livedata-topbar {display: none !important;} .livedata-bottombar {display: none !important;}

FAQ

Can a Live Data list entries from another wiki of the farm?

Working around XWIKI-22688, name the results page with its full reference, as in resultPage=xwiki:XWiki.LiveTableResults, and set the displayers by hand.

How do I check what a live table would look like as a Live Data?

Add useLiveData=true to the query string of the page holding it. Nothing is modified.

Why are the property names displayed as translation keys?

Because translationPrefix is missing, or does not match the keys declaring the property names.

Related

Get Connected