Wiki source code of Live Data JavaScript API
Last modified by superadmin on 2026/11/25 21:39
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Live Data provides a JavaScript API on the container of each instance, reached through the ##liveData## jQuery data-property (as in ##jQuery("#wikis").data("liveData")##) and in [[Live Data events>>xwiki:Documentation.DevGuide.FrontendResources.JavaScriptAPI.WebHome||anchor="HLiveDataevents28Logic.js29"]]. | ||
| 2 | |||
| 3 | == Methods == | ||
| 4 | |||
| 5 | |=Member|=Returns|=What it does | ||
| 6 | |##getLayoutIds()##|An array of layout ids|Lists the layouts the reader may switch to | ||
| 7 | |##getPropertyDescriptors()##|An array of property descriptors|Lists the properties the instance knows, with their type, their displayer and their filter | ||
| 8 | |##updateEntries()##|Nothing|Reloads the entries, with the filters and the sort currently applied | ||
| 9 | |||
| 10 | {{code language="javascript"}} | ||
| 11 | jQuery("#myld").data("liveData").getLayoutIds(); | ||
| 12 | jQuery("#myld").data("liveData").getPropertyDescriptors(); | ||
| 13 | jQuery("#myld").data("liveData").updateEntries(); | ||
| 14 | {{/code}} | ||
| 15 | |||
| 16 | == HTML Attributes == | ||
| 17 | |||
| 18 | These attributes select Live Data elements without depending on a layout, which is what makes a stylesheet or a test survive the reader switching layout. | ||
| 19 | |||
| 20 | |=Attribute|=Set on|=Holds | ||
| 21 | |##data-livedata-property-id##|Every property displayer|The id of the property being displayed | ||
| 22 | |##data-livedata-entry-index##|The root element of an entry|The index of that entry in the page of results currently displayed | ||
| 23 | |##data-livedata-entry-id##|The root element of an entry|The value identifying that entry |