cogAdd an export button to a livetable.
TypeXAR
CategoryMacro
Developed by

Guillaume Delhumeau, Anca Luca, slauriere

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

Description

Adds an export button to a livetable generated by the Livetable Macro for exporting data in CSV, JSON or XLS.

livetable.png

csv-export.png

Usage

  • Step 1: add a livetable to a page using the Livetable Macro.
  • Step 2: add the code below to the page, and replace "livetable-id" by the identifier of the livetable to be exported, created in step 1.
{{livetableExporter livetable="livetable-id" /}}

If you need to let users export a livetable in different formats, you will need to call the macros several times, for instance as follows:

{{livetableExporter livetable="livetable-id" format="csv" /}} {{livetableExporter livetable="livetable-id" format="excel" /}}

This macro obsoletes LiveTableExcelExport Macro.

Parameters

NameDescriptionMandatoryDefault
livetable

The livetable where you want to add the file export.

Yes
withPageName

Set to "true" for adding a column containing the wiki page name.

Notrue
withPageURL

Set to "true" for adding a column containing the wiki page URL.

Notrue
withAllFields

Set to "true" for forcing the export of all the fields of the class of the livetable (if any class is selected), instead of just the ones displayed as columns in the displayed livetable.

Nofalse
filename

The output filename (without extension), to which the results will be exported.

No
customResults

Name of a custom page generating the results, if different than the default.

NoMacros.LivetableExporterMacroResults
format

Export format to be used: "excel" (default), "csv" or "json".

Noexcel
label

Label of the export button.

No

Note on scalability

This macro exports all the results from the target livetable, while upon display on screen the results are paginated. Because of this, the time needed to perform the export depends on the total number of entries in the livetable. Depending on the application server settings, the web server (the servlet container or another HTTP server such as Apache) may return an internal server error before the export completes, and thus the export will not work. A solution in this case is to increase the timeout delay of the web server, that is the delay after which the server will return an error.

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

In order to perform exports in XLS format, the Excel plugin needs to get installed, and delcared in the xwiki.cfg in the list of active plugins.

Make sure that this macro pages are authored by a user with programming rights.

Troubleshooting

In old wikis, the macro may not work. In case you face the issue please edit the page "Macros.AddExcelExportToLivetableMacro" with the object editor, find the "WikiMacroClass" object  and remove the following line from the object content:

var livetable = window.livetable_$xcontext.macro.params.livetable;

Release Notes

v3.1

  • Closed XALTXLS-19 Introduce a "limit" parameter in order to control the maximum number of entries that can get exported

v3.0

Dependencies

Dependencies for this extension (org.xwiki.contrib:xwiki-livetable-exporter-macro 3.1):

Tags:
Created by slauriere on 2019/02/07 10:50
    

Get Connected