Multiselect custom display

Last modified by Clemens Robbenhaar on 2024/10/05 11:18

cogThis is a custom suggest displayer for DBList object properties which adapts the suggest feature to multiple selection.
TypeXAR
Category
Developed by

Ludovic Dubost, Marta Girdea, Anca Luca, Raluca Stavro, Paul Pantiru, Mohamed Boussaa

Active Installs25
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

This is a custom suggest displayer for DBList object properties which adapts the suggest feature to multiple selection.

Usage

Please note that this extension will only work for properties which have explicit hibernate queries set. Properties configured using the  XWiki class name, id field name and value field name settings cannot be enhanced using this extension (actually, suggest won't work at all on such properties).

Note: because of a bug in XWiki < 6.4.5, the hibernate query must be tipped with lower case characters only. Eg: "select .. from" instead of "SELECT ... FROM".

To activate it, you must edit the XClass and set, for the target property, the fields Use suggest and Multiple select to true, Display Type to input and the field Custom display to:

{{include document="XWiki.SuggestDisplay" /}}

I the Custom display you can also add a few options:

{{velocity}}
  #set($isUser = true)
  #set($isLink = true)
  #set($isExternalLink = true)
  #set($displayAddButton = true)
{{/velocity}}

 The autosuggest widget will not work if Main.WebHome is not saved with programming rights ( https://jira.xwiki.org/browse/XE-539

Edit items

Since the version 1.3, it is now possible to edit the items selected, or to create new ones.

To enable this feature, you need to set the following variable in the custom displayer:

#set($SuggestDisplayItemsEditable = true)

To force the space where the new items will be created:

#set($SuggestDisplayEditModeSpace = "yourSpace")

Screenshots

customDisplay.png

With the options to edit items:

suggest-with-editable-mode.png

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

After importing the XAR, the document XWiki.SuggestDisplay is created and can be used as described above.

Release Notes

v1.5

v1.4

v1.3

v1.2

Added support for upgrade from earlier versions, with Extension Manager

v1.1

New version with:

  • Compatibility with 5.2 +
  • Added options for add button, $isLink, $isExternalLink and $isUser
  • Added drag & drop functionality for reordering values
  • Fixed conflict with single select with suggest
  • Fixed bug with values containing comma
    Issue:
  • Version 1.0 cannot be simply upgraded to 1.1 via Extension Manager (the old version has to be removed and the new one installed)

v1.0

Initial version

Dependencies

Dependencies for this extension (org.xwiki.contrib:displayer-multiselect-suggest 1.6):

  • org.webjars:jquery-form 3.51

Get Connected