In-place edit for object properties

Last modified by Vincent Massol on 2022/01/25

You can enable in-place editing for an existing XWiki application, if you're using the Vertical Form layout, by editing the application sheet (the page used to display the application entries) and operating 2 changes:

  1. Load the JavaScript code required for in-place editing and define some variables:
    #set ($discard = $xwiki.jsfx.use('uicomponents/edit/editableProperty.js', {
      'forceSkinAction': true,
      'language': $xcontext.locale
    }))
    #set ($object = $doc.getObject('Path.To.YourClass'))
    #set ($editing = $xcontext.action == 'edit')
  2. Add some meta data to the definition term (dt) elements that wrap the field names:
    <dt #if (!$editing && $hasEdit)
        class="editableProperty"
        data-property="$escapetool.xml($services.model.serialize($object.getProperty('yourProperty').reference))"
        data-property-type="object"#end>

The result should look like this:

editObjectPropertyInPlace.png

Get Connected