<
From version < 45.1 >
edited by Simon Urli
on 2022/01/12
To version < 46.1 >
edited by Michael Hamann
on 2022/05/13
>
Change comment: Document Live Data events

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.surli
1 +XWiki.MichaelHamann
Content
... ... @@ -24,7 +24,9 @@
24 24  
25 25  * (((
26 26  **##xwiki:dom:loaded##**
27 -This event is similar to [[prototype's dom:loaded event>>http://prototypejs.org/doc/latest/dom/document/observe/]], with the difference that in the time-lapse between ##dom:loaded## and ##xwiki:dom:loaded##, XWiki may have transformed the DOM. Example of DOM transformations operated by XWiki is setting the right target of links that have rel="external" attribute so that the document can be XHTML valid and still have the desired effect, making internal rendering error messages expandable, insert document template handlers for links to non-existent documents, and so on. In the future there might be more transformations operated by XWiki upon DOM initialization. This event is meant for code to be notified of loading of the XWiki-transformed version of the initial DOM. As ##dom:loaded##, it can be used as follows:(((
27 +This event is similar to [[prototype's dom:loaded event>>http://prototypejs.org/doc/latest/dom/document/observe/]], with the difference that in the time-lapse between ##dom:loaded## and ##xwiki:dom:loaded##, XWiki may have transformed the DOM. Example of DOM transformations operated by XWiki is setting the right target of links that have rel="external" attribute so that the document can be XHTML valid and still have the desired effect, making internal rendering error messages expandable, insert document template handlers for links to non-existent documents, and so on. In the future there might be more transformations operated by XWiki upon DOM initialization. This event is meant for code to be notified of loading of the XWiki-transformed version of the initial DOM. As ##dom:loaded##, it can be used as follows:
28 +
29 +(((
28 28  {{code language="javascript"}}
29 29  document.observe("xwiki:dom:loaded", function(){
30 30   // Initialization that can rely on the fact the DOM is XWiki-tranformed goes here.
... ... @@ -88,7 +88,9 @@
88 88  This event is sent after the user clicks the "Save" or "Save & Continue" button from an edit mode, but before the edit form is validated. You can use this event to update the form fields before they are submitted to the save action.
89 89  * (((
90 90  **##xwiki:actions:save##**
91 -This event is sent after the edit form has been validated, as a result of the user clicking the "Save" or "Save & Continue" button from an edit mode, but before the form is submitted. The event is fired only if the edit form is valid. A memo is available if you need to know if the intend is to continue after the save, in ##event.memo['continue']##. You can use it as follows:(((
93 +This event is sent after the edit form has been validated, as a result of the user clicking the "Save" or "Save & Continue" button from an edit mode, but before the form is submitted. The event is fired only if the edit form is valid. A memo is available if you need to know if the intend is to continue after the save, in ##event.memo['continue']##. You can use it as follows:
94 +
95 +(((
92 92  {{code language="javascript"}}
93 93  document.observe("xwiki:actions:save", function(event){
94 94   var doContinue = event.memo['continue'];
... ... @@ -159,6 +159,23 @@
159 159  
160 160  The livetable sends both generic events, named as above, and events specific to each livetable, containing the table name on the third position, such as ##xwiki:livetable:alldocs:loadingEntries##. The generic event has the table name in the memo, as ##event.memo.tableId##.
161 161  
166 +== Live Data events (Logic.js) ==
167 +
168 +* **##xwiki:livedata:instanceCreated##** (since 14.4 RC1) triggered when the DOM elements have been created and the instance initialized but potentially before entries are loaded
169 +* ##**xwiki:livedata:beforeEntryFetch**## (since 13.4 RC1)
170 +* ##**xwiki:livedata:afterEntryFetch**## (since 13.4 RC1)
171 +* ##**xwiki:livedata:layoutChange**## (since 12.10)
172 +* ##**xwiki:livedata:layoutLoaded**## (since 13.4 RC1)
173 +* ##**xwiki:livedata:pageChange**## (since 12.10) with ##pageIndex## and ##previousPageIndex##
174 +* ##**xwiki:livedata:pageSizeChange**## (since 12.10) with ##pageSize## and ##previousPageSize##
175 +* ##**xwiki:livedata:select**## (since 12.10) with ##entry##
176 +* ##**xwiki:livedata:deselect**## (since 12.10) with ##entry##
177 +* ##**xwiki:livedata:selectGlobal**## (since 12.10)
178 +* ##**xwiki:livedata:sort**## (since 12.10) with ##property##, ##level## or ##type, and ##descending##
179 +* ##**xwiki:livedata:filter**## (since 12.10) with ##type##, ##property## and ##removedFilters## or ##oldEntry##/##newEntry##
180 +
181 +All events are dispatched on the container that is wrapping the Live Data as native custom events. All events have the Live Data instance set as ##detail.livedata##. Additional properties are available depending on the event and the situation in which the event is triggered, some of them are listed above. Before 14.4RC1 and 13.10.6, the events were triggered on a detached DOM element and thus it was not really possible to register event listeners for them.
182 +
162 162  = RequireJS and jQuery APIs =
163 163  
164 164  By default XWiki uses PrototypeJS which is bound to the $ symbol. Starting in XWiki 5.2, you may use jQuery by //requiring// it using the [[RequireJS>>http://requirejs.org/]] AMD standard. To do this you would write your code as follows:

Get Connected