<
From version < 10.1 >
edited by Sergiu Dumitriu
on 2010/11/06
To version < 11.1 >
edited by Sergiu Dumitriu
on 2010/11/06
>
Change comment: Enhanced event descriptions.

Summary

Details

Page properties
Content
... ... @@ -22,20 +22,16 @@
22 22  
23 23  === DOM Events (xwiki.js) ===
24 24  
25 -* **##xwiki:dom:loading##** (((
26 -This event is similar to [[prototype's dom:loaded event>>http://www.prototypejs.org/api/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 follow:
27 -
25 +* **##xwiki:dom:loaded##**
26 +This event is similar to [[prototype's dom:loaded event>>http://www.prototypejs.org/api/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 follow:(((
28 28  {{code}}
29 29  document.observe("xwiki:dom:loaded", function(){
30 30   // Initialization that can rely on the fact the DOM is XWiki-tranformed goes here.
31 31  });
32 -{{/code}}
33 -
31 +{{/code}})))
34 34  **It is recommended to bind startup scripts to this event** instead of ##window.load## or ##document.dom:loaded##.
35 -)))
36 -* **##xwiki:dom:loaded##** (((
33 +* **##xwiki:dom:loading##**
37 37  ##xwiki:dom:loading## is sent between ##dom:loaded## and ##xwiki:dom:loaded##, before XWiki changes the DOM. This is the event that should start all scripts making important DOM changes that other scripts should see.
38 -)))
39 39  
40 40  === Document content events (actionButtons.js) ===
41 41  
... ... @@ -50,9 +50,8 @@
50 50  This event is sent after the user clicks the "Cancel" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually cancelling the edit.
51 51  * **##xwiki:actions:preview##**
52 52  This event is sent after ther use clicks the "Preview" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually leaving the edit mode.
53 -* **##xwiki:actions:save##**(((
54 -This event is sent after the user clicks the "Save" or "Save & Continue" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually submitting the form. 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:
55 -
49 +* **##xwiki:actions:save##**
50 +This event is sent after the user clicks the "Save" or "Save & Continue" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually submitting the form. 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:(((
56 56  {{code language="javascript"}}
57 57  document.observe("xwiki:dom:loaded", function(event){
58 58   var doContinue = event.memo.continue;
... ... @@ -60,16 +60,14 @@
60 60   // do something specific
61 61   }
62 62  });
63 -{{/code}}
64 -)))
58 +{{/code}})))
65 65  
66 66  All these events contain as extra information, in the second parameter sent to event listeners (the memo), the original click event (if any, and which can be stopped to prevent the action from completing), and the form being submitted, as ##event.memo.originalEvent##, and ##event.memo.form## respectively.
67 67  
68 68  === Document extra events (xwiki.js) ===
69 69  
70 -* **##xwiki:docextra:loaded##**(((
71 -This event is fired upon reception of the content of a document footer tab by AJAX. This event is useful if you need to operate transformations of the received content. You can filter on which tab content to operate (comments or attachment or information or ...) using the event memo. The DOM element in which the retrieved content has been injected is also passed to facilitate transformations.
72 -
64 +* **##xwiki:docextra:loaded##**
65 +This event is fired upon reception of the content of a document footer tab by AJAX. This event is useful if you need to operate transformations of the received content. You can filter on which tab content to operate (comments or attachment or information or ...) using the event memo. The DOM element in which the retrieved content has been injected is also passed to facilitate transformations.(((
73 73  {{code language="javascript"}}
74 74  document.observe("xwiki:docextra:loaded", function(event){
75 75   var tabID = event.memo.id;
... ... @@ -81,7 +81,6 @@
81 81  {{/code}}
82 82  )))
83 83  * **##xwiki:docextra:activated##**
84 -
85 85  This event is fired upon activation of a tab. It differs from the loaded event since tabs are loaded only once if the user clicks going back and forth between tabs. This event will notify of each tab activation, just after the tab content is actually made visible. The tab ID is passed in the memo as for ##xwiki:docextra:loaded##
86 86  
87 87  === WYSIWYG events (XWikiWysiwyg.js) ===
... ... @@ -91,15 +91,16 @@
91 91  === Suggest events (ajaxSuggest.js) ===
92 92  
93 93  * **##xwiki:suggest:selected##** (since 2.3)
86 +This event is fired on the target input when a value was selected.
94 94  
95 -This event is fired when a value was selected
96 -
97 97  === Fullscreen events (fullScreenEdit.js) (since 2.5.1) ===
98 98  
99 -* **##xwiki:fullscreen:entered##**
100 -* **##xwiki:fullscreen:exited##**
101 -* **##xwiki:fullscreen:resized##**
90 +* **##xwiki:fullscreen:entered##**
91 +* **##xwiki:fullscreen:exited##**
92 +* **##xwiki:fullscreen:resized##**
102 102  
94 +All events have the target DOM element in ##event.memo.target##.
95 +
103 103  === Annotations events (AnnotationCode/Settings jsx) ===
104 104  
105 105  * **##xwiki:annotations:filter:changed##**
... ... @@ -107,9 +107,11 @@
107 107  
108 108  === Livetable events (livetable.js) ===
109 109  
110 -* **##xwiki:livetable:newrow##**
103 +* **##xwiki:livetable:newrow##** (##event.memo.row## holds the new row)
111 111  * **##xwiki:livetable:loadingEntries##** (since 2.3 RC1)
112 -* **##xwiki:livetable:receivedEntries##** (since 2.3 RC1)
113 -* **##xwiki:livetable:loadingComplete##** (since 2.4 M1)
105 +* **##xwiki:livetable:receivedEntries##** (since 2.3 RC1) (##event.memo.data## contains the received JSON data)
106 +* **##xwiki:livetable:loadingComplete##** (since 2.4 M1) (##event.memo.status## contains the response status code)
114 114  * **##xwiki:livetable:displayComplete##** (since 2.4 M1)
115 115  * **##xwiki:livetable:ready##** (since 2.4.4)
109 +
110 +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##.

Get Connected