page_whiteLists all documents in a certain space
Developed by

Paul Libbrecht, Vincent Massol

0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents


This example lists all documents in the Blog space:

#set($hql = "where'Blog' order by asc")
#set($results = $xwiki.searchDocuments($hql, 0, 0))
#foreach ($item in $results)
 * $item

See also the Velocity Examples.

That can also be used within an XWiki Class Property, e.g. to construct a field that chooses among the documents of a given space: Just say that this property is of type Database List and use the following for the query field:

select, doc.title
from com.xpn.xwiki.doc.XWikiDocument as doc
 where = 'MySpace'

Editing a class-instance with the default display method doc.display('field-name') then brings a pop-up with the names of all documents of that space.

Tags: querying

Get Connected