cogAdds the option to select the rows of a livetable by inserting a new column with checkboxes in the table.
TypeXAR
CategoryMacro
Developed by

Raluca Stavro

Active Installs32
Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1
Installable with the Extension Manager

Description

This macro is relying on the fix for XWIKI-12722.
This bug was introduced in version 2.6 (long time ago) so it is very possible that you have it on your XWiki instance. The fix is very simple and you have to apply it if you need to use this macro.

This macro is adding a new column in the livetable containing checkboxes for selecting table rows. It supports the following parameters :

NameDescriptionIs Mandatory
livetableThe id of the livetableYes
columnThe target column to use the values of when selecting items in the checkbox columnYes
serviceDocumentThe name of the document acting as service for the selected valuesNo
buttonIdThe id of the element that is clicked for sending data to the service documentNo

Example of usage

The code

{{html}}
 <div class="buttonwrapper">
   <a href="" id="checkboxService" class="button">Send checkbox data</a>
 </div>
{{/html}}

{{velocity}}
  #set($columns = ['doc.fullName', 'doc.title', 'doc.author', 'doc.date'])
  #set($columnsProperties = {
    'doc.fullName' : { 'type' : 'hidden' },
    'doc.title' : { 'displayName' : 'Title' } ,
    'doc.author' : { 'displayName' : 'Author' } ,
    'doc.date' : { 'displayName' : 'Date' }
  })
  #set($options = {
     'extraParams':'&space=XWiki',
     'queryFilters': '&hidden=true'
  })
  #livetable('myLivetable' $columns $columnsProperties $options)
{{/velocity}}

{{addCheckboxColumnToLivetable livetable="myLivetable" column="doc.fullName" buttonId="checkboxService" serviceDocument="Code.ServiceDocument" /}}

The result

1. The livetable

Selecting multiple values of the doc.fullName colum that is hidden in this example :

AddCheckboxColumnToLivetable.png

2. Sending data to the service document

The URL of the Ajax request sent by the macro :

http://localhost:8080/xwiki/bin/Code/ServiceDocument?autputSyntax=plain&xpage=plain&cbData=docsmanagement%3AXWiki.AdminEditingSheet&cbData=docsmanagement%3AXWiki.AdminElementsSheet&cbData=docsmanagement%3AXWiki.AdminGroupsSheet&cbData=docsmanagement%3AXWiki.AccountValidation&cbData=docsmanagement%3AXWiki.AdminExportSheet

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

Release Notes

v1.0.3

  • Closed LCC-5 Checkboxes are not displayed in the given livetable column

v1.0.2

  • Closed LCC-3 The livetbale header is shifted on left if the selected column is not the first one

v1.0.1

  • Closed LCC-2 JS Error when calling the Livetable Checkbox Column macro

v1.0

  • Closed LCC-1 Add the option to select the rows of a livetable by inserting a new column with checkboxes in the table
Tags:
Created by Raluca Stavro on 2015/10/29 14:58
    

Get Connected