Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-3706

Provide a velocity macro to automate the creation of live tables

    Details

    • Difficulty:
      Medium
    • Similar issues:

      Description

      This will allow to display a live table of data using only one macro call.

      Example of generic usage to display data for a XWiki class (here XWiki.XWikiUsers to display all users in the wiki)

      {{velocity}}
      #set($collist = [ "_avatar", "first_name", "last_name", "email"])
      #set($colprops = {
                         "first_name" : { "type" : "text" , "size" : 10, "link" : "view"}, 
                         "last_name" : { "type" : "text" , "size" : 10, "link" : "view"},
                         "email" : { "type" : "text" , "size" : 20, "link" : "editor"},
                         "_avatar" : { "type" : "none" , "size" : 20, "link" : "none", "html" : "true", "sortable":false }
                       })
      #set($options = { "className":"XWiki.XWikiUsers",
                        "translationPrefix" : "xe.index.users." })
      #livetable("userstable" $collist $colprops $options)
      {{/velocity}}
      

      Exemple of usage with a custom result URL and a custom javascript callback to build the table entries :

      {{velocity}}
      #set($collist = ["doc.name", "doc.space","doc.date", "doc.author", "actions"])
      #set($colprops = {
                         "doc.name" : { "type" : "text" , "size" : 10, "link" : "view"}, 
                         "doc.space" : { "type" : "text" , "size" : 10, "link" : "space"},
                         "doc.date" : { "type" : "date" },
                         "doc.author" : { "type" : "text" , "size" : 10, "link" : "author"},
                         "actions" : {"sortable": false}
                       })
      #set($options = { "url":"$xwiki.getURL('XWiki.Tableresults')?xpage=plain",
                        "callback" : "displayAllDocs", 
                        "translationPrefix" : "xe.index." })
      #livetable("alldocs" $collist $colprops $options)
      {{/velocity}}
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jerome Jerome Velociter
                Reporter:
                jerome Jerome Velociter
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: