Implementation
 Dormant
  • Open XWIKI-7735 Create a LiveTable 2.0 macro using new rendering system

Description

Livetable Macro

{{livetable source="hint of livetable data source component" id="..." tags="true|false" order="asc|desc" params="param=value,..." ...}}
// Optional definition of how to display columns, it's optional as column definition will be defined in the returned JSON
columnname1: { "sort" : "true", "filter" : "true", "visible" : "true" }
columnname2: { "sort" : "true", "filter" : "true", "visible" : "true" }
...
columnnameN: { "sort" : "true", "filter" : "true", "visible" : "true" }
{{/livetable}}

Livetable Data Source

  • They are java components with one method Map generateData()
  • We have a LivetableDataSourceClass with an "id" (the component hint), and the document content acting as the content for the data source that return the Map (store it in some context variable)
  • Works the same as Wiki Macros
  • Thus data source can be defined either in Java or in wiki pages

REST Services

  • A REST Service receives the calls from the livetable JS and return JSON by calling the Livetable Data Source corresponding the passed hint

Script Service

  • A Livetable SS is provided to call a given Livetable DS from a wiki DS for example
  • Example of a wiki DS that customize some other DS:
    ## Customize params for the DS here
    ...
    #set ($map = $services.livetable.generateData())
    ## Customize generate Map here
    ...
    ## Save back the map
    $services.livetable.saveData($map)

UC: display table from XClass

{{livetable source="xclass" params="class=XWiki.XWikiUsers"/}}

To make it even easier to use we'll have a new wiki macro:

{{classes class="XWiki.XWikiUsers"/}}

UC: data is small enough to be in memory

In a custom wiki DS:

{{velocity}}
#set ($map = .. construct map ...)
...
#set ($filteredMap = $services.livetable.filter($map)) <-- filter map based on livetable params: offset, start, number of items, sort column and order, etc
$services.livetable.saveData($filteredMap)
{{/velocity}}

UC: Displays documents

{{livetable source="documents" params="query=..."/}}

To make it even easier to use we'll have a new wiki macro:

{{documents query="...where clause of a XWQL query..."/}} 

Note: Can be used for AllDocs or Space index.


 

Tags:
Created by Ecaterina Moraru (Valica) on 2013/11/06 13:04
    

Get Connected