Customize filter conditions in # livetable macro in XWiki

Source: Internet
Author: User

Customize filter conditions in # livetable macro in XWiki

The following text is an example description in # livetable's online document: see here.

Filter organizations by domain
The organization class in the example below has two properties: an org_name of type String and an org_domain of type StaticList. the organization domain can have values like Software or Hardware, which will be used in the live table as filter options.

# Set ($ columns = ["org_name", "org_domain"])
# Set ($ columnsProperties = {
"Org_name": {"type": "text", "size": 20, "link": "view "},
"Org_domain": {"type": "list", "class": "MySpace. OrganizationClass "}
})

# Set ($ options = {
"ResultPage": "MySpace. ListOrganizationJSON ",
"TranslationPrefix ":"",
"RowCount": 10
})
# Livetable ("organization_directory" $ columns $ columnsProperties $ options)
The content of MySpace. ListOrganizationJSON (using syntax 2.0 ):

{Include document = "XWiki. LiveTableResultsMacros "/}}
{Velocity }}
# Gridresultwithfilter ("MySpace. organizationClass "$ request. collist. split (",") "" and doc. name <> 'organizationsheet 'and doc. name <> 'organizationtemplate '")
{/Velocity }}

In this example, the question is not correct. In fact, when filtering, we usually filter the attributes of the actual object (such as the object in the OrganizationClass document in this example). For example, there is a class: XWiki. danJuSummaryClass has the attribute version (string). The table shows all the documents whose version attribute value is V7.0. How can I write filter conditions?

Refer to the following example to create a page (for example, the MySpace. ListOrganizationJSON page in the above example)

{Include document = "XWiki. LiveTableResultsMacros "/}}
{Velocity }}
# Gridresultwithfilter ("XWiki. danJuSummaryClass "$ request. collist. split (",") ", StringProperty as sp" "and sp. name = 'version' and sp. value = 'v7. 0 'and obj. id = sp. id ")
{/Velocity }}

SringProperty is the storage object of all string properties in XWIKI, And the last condition obj. id = sp. id is very important. It is equivalent to the association condition in SQL. If the filtering logic without this condition is incorrect, the result is also incorrect.

XWiki installation tips

For installation and configuration of Linux + Tomcat + XWiki + MySQL, see

XWiki installation tutorial and language configuration change

Install Java open-source Knowledge Base XWiki in Windows

XWiki details: click here
XWiki: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.