From version < 7.2 >
edited by Ecaterina Moraru (Valica)
on 2010/11/04
To version < 8.1 >
edited by Ecaterina Moraru (Valica)
on 2010/11/05
< >
Change comment: Added AjaxSuggest xwiki:suggest:selected event



Page properties
... ... @@ -96,6 +96,12 @@
96 96  
97 97  WYSIWYG has it's own custom [events list>].
98 98  
99 +1.1.1 Suggest events (ajaxSuggest.js)
100 +
101 +* *<tt>xwiki:suggest:selected</tt>* (since 2.3)
102 +
103 +This event is fired when a value was selected
104 +
99 99  1.1.1 Fullscreen events (fullScreenEdit.js) (since 2.5.1)
100 100  
101 101  * *<tt>xwiki:fullscreen:entered</tt>*
Contents:The [toc] macro is a standalone macro and it cannot be used inline

XWiki JavaScript API

Observable XWiki Events

Stay in touch with what happens in the wiki! XWiki will fire custom javascript events on certain moment and upon certain actions that occur in the navigation flow.

Event names are build on the following model: xwiki:modulename:eventname. Your JavaScript script or extension can get notified of such an event the following way:

document.observe("xwiki:modulename:eventname", function(event){
  // Here, do something that will be executed at the moment the event is fired

  // The event can have an option memo object to pass to its observers some information:

Check out the real examples below, or read more about Prototype.js's event system

DOM Events (xwiki.js)

  • xwiki:dom:loading 
  • xwiki:dom:loaded

These events are similar to prototype's dom:loaded event, 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. 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:

document.observe("xwiki:dom:loaded", function(){
  // Initialization that can rely on the fact the DOM is XWiki-tranformed goes here.

It is recommended to bind startup scripts to this event instead of window.load or document.dom:loaded.

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.

Document content events (actionButtons.js)

  • xwiki:document:saved 

This is event is sent after the document has been successfully saved in an asynchronous request (i.e. after clicking the Save and Continue button).

  • xwiki:document:saveFailed 

Action events (actionButtons.js)

  • xwiki:actions:cancel 

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.

  • xwiki:actions:preview 

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.

  • xwiki:actions:save

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:

document.observe("xwiki:dom:loaded", function(event){
  var doContinue = event.memo.continue;
  if (doContinue) {
    // do something specific

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.

Document extra events (xwiki.js)

  • xwiki:docextra:loaded 

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.

document.observe("xwiki:docextra:loaded", function(event){
  var tabID =;
  if (tabID == "attachments") {
    // do something with the attachments tab retrieved content.
  • xwiki:docextra:activated

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

WYSIWYG events (XWikiWysiwyg.js)

WYSIWYG has it's own custom events list.

Suggest events (ajaxSuggest.js)

  • xwiki:suggest:selected (since 2.3)

This event is fired when a value was selected

Fullscreen events (fullScreenEdit.js) (since 2.5.1)

  • xwiki:fullscreen:entered 
  • xwiki:fullscreen:exited 
  • xwiki:fullscreen:resized 

Annotations events (AnnotationCode/Settings jsx)

  • xwiki:annotations:filter:changed
  • xwiki:annotations:settings:loaded

Livetable events (livetable.js)

  • xwiki:livetable:newrow
  • xwiki:livetable:loadingEntries (since 2.3 RC1)
  • xwiki:livetable:receivedEntries (since 2.3 RC1)
  • xwiki:livetable:loadingComplete (since 2.4 M1)
  • xwiki:livetable:displayComplete (since 2.4 M1)
  • xwiki:livetable:ready (since 2.4.4)

Get Connected