This issue has been created
There are 2 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-d9af7494-0d26-4d4e-b8e1-2ead7d6298bd XWIKI-23606 Open

Make XWiki.LiveTableResults almost empty, to be reusable

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-e6cf7d52-5304-4661-b38b-8d71af10ceff Vincent Massol created this issue on 16/Oct/25 14:24
 
Summary: Make XWiki.LiveTableResults almost empty to be reusable
Issue Type: cid:jira-generated-image-avatar-d9af7494-0d26-4d4e-b8e1-2ead7d6298bd Improvement
Affects Versions: 16.10.0
Assignee: Unassigned
Components: LiveTable
Created: 16/Oct/25 14:24
Priority: cid:jira-generated-image-static-major-195a2bcd-e660-4510-b9fd-eff9be833a36 Major
Reporter: Vincent Massol
Description:

It's painful to use a custom LT results page since it means replacing the default one and the default one now have a lot of additional features that you loose unless you duplicate them in your own custom page:

{{include reference="XWiki.LiveTableResultsMacros" /}}

{{velocity wiki="false"}}
## the $extra variable is passed to the call to #gridresultwithfilter below and is used to perform some default
## filtering on the LiveTable data even when the user has not performed any column filtering yet.
## When users start using column filtering, the generated DB query will combine both the default filtering and what the
## user has entered in the column filters.
#set ($extra = '')
#set ($params = {})
#if ("$!request.space" != '')
  #set ($extra = "${extra} AND doc.space = :doc_space")
  #set ($discard = $params.put('doc_space', $request.space))
#end
## Use filterLocation since addLivetableLocationFilter is buggy when called several times (it'll add the
## same HQL binding name every time it's called! See https://jira.xwiki.org/browse/XWIKI-17463).
## Also note that we don't call addLocationFilter since we use a Map for $params.
#filterLocation($extra, $params, $!request.location, 'locationFilterValue1')
#if ("$!request.parent" != '')
  #set ($extra = "${extra} and doc.parent = :doc_parent")
  #set ($discard = $params.put('doc_parent', $request.parent))
#end
#if ("$!request.orphaned" == '1')
  #set ($homepage = $services.wiki.getById($services.wiki.currentWikiId).mainPageReference)
  #set ($homepageFullName = $services.model.serialize($homepage, 'local'))
  ## On Oracle the empty parent is actually null.
  #set ($extra = "${extra} and (doc.parent = '' or doc.parent is null) and doc.fullName <> :homepageFullName")
  #set ($discard = $params.put('homepageFullName', $homepageFullName))
#end
#gridresultwithfilter("$!request.classname" $request.collist.split(',') '' "${extra}" $params)
{{/velocity}}

For ex here's what I had to write just to exclude some space from the results(notice that ony lines 8-9 are modified):

{{include reference="XWiki.LiveTableResultsMacros" /}}

{{velocity wiki="false"}}
## the $extra variable is passed to the call to #gridresultwithfilter below and is used to perform some default
## filtering on the LiveTable data even when the user has not performed any column filtering yet.
## When users start using column filtering, the generated DB query will combine both the default filtering and what the
## user has entered in the column filters.
#set ($extra = 'AND doc.space <> :docapp_space')
#set ($params = {'docapp_space' : 'DocApp.Code'})
#if ("$!request.space" != '')
  #set ($extra = "${extra} AND doc.space = :doc_space")
  #set ($discard = $params.put('doc_space', $request.space))
#end
## Use filterLocation since addLivetableLocationFilter is buggy when called several times (it'll add the
## same HQL binding name every time it's called! See https://jira.xwiki.org/browse/XWIKI-17463).
## Also note that we don't call addLocationFilter since we use a Map for $params.
#filterLocation($extra, $params, $!request.location, 'locationFilterValue1')
#if ("$!request.parent" != '')
  #set ($extra = "${extra} and doc.parent = :doc_parent")
  #set ($discard = $params.put('doc_parent', $request.parent))
#end
#if ("$!request.orphaned" == '1')
  #set ($homepage = $services.wiki.getById($services.wiki.currentWikiId).mainPageReference)
  #set ($homepageFullName = $services.model.serialize($homepage, 'local'))
  ## On Oracle the empty parent is actually null.
  #set ($extra = "${extra} and (doc.parent = '' or doc.parent is null) and doc.fullName &lt;&gt; :homepageFullName")
  #set ($discard = $params.put('homepageFullName', $homepageFullName))
#end
#gridresultwithfilter("$!request.classname" $request.collist.split(',') '' "${extra}" $params)
{{/velocity}}
 
 

2 updates

 
cid:jira-generated-image-avatar-e6cf7d52-5304-4661-b38b-8d71af10ceff Changes by Vincent Massol on 16/Oct/25 14:24
 
Summary: Make XWiki.LiveTableResults almost empty , to be reusable
Description: It's painful to use a custom LT results page since it means replacing the default one and the default one now have a lot of additional features that you loose unless you duplicate them in your own custom page:

{code}
{{include reference="XWiki.LiveTableResultsMacros" /}}

{{velocity wiki="false"}}
## the $extra variable is passed to the call to #gridresultwithfilter below and is used to perform some default
## filtering on the LiveTable data even when the user has not performed any column filtering yet.
## When users start using column filtering, the generated DB query will combine both the default filtering and what the
## user has entered in the column filters.
#set ($extra = '')
#set ($params = {})
#if ("$!request.space" != '')
  #set ($extra = "${extra} AND doc.space = :doc_space")
  #set ($discard = $params.put('doc_space', $request.space))
#end
## Use filterLocation since addLivetableLocationFilter is buggy when called several times (it'll add the
## same HQL binding name every time it's called! See https://jira.xwiki.org/browse/XWIKI-17463).
## Also note that we don't call addLocationFilter since we use a Map for $params.
#filterLocation($extra, $params, $!request.location, 'locationFilterValue1')
#if ("$!request.parent" != '')
  #set ($extra = "${extra} and doc.parent = :doc_parent")
  #set ($discard = $params.put('doc_parent', $request.parent))
#end
#if ("$!request.orphaned" == '1')
  #set ($homepage = $services.wiki.getById($services.wiki.currentWikiId).mainPageReference)
  #set ($homepageFullName = $services.model.serialize($homepage, 'local'))
  ## On Oracle the empty parent is actually null.
  #set ($extra = "${extra} and (doc.parent = '' or doc.parent is null) and doc.fullName &lt;&gt; :homepageFullName")
  #set ($discard = $params.put('homepageFullName', $homepageFullName))
#end
#gridresultwithfilter("$!request.classname" $request.collist.split(',') '' "${extra}" $params)
{{/velocity}}
{code}

For ex here's what I had to write just to exclude some space from the results(notice Note that ony lines 8-9 are modified):

{code}
{{include reference="XWiki.LiveTableResultsMacros" /}}

{{velocity wiki="false"}}
## the $extra variable is passed to the call to #gridresultwithfilter below and is used to perform some default
## filtering on the LiveTable data even when the user has not performed any column filtering yet.
## When users start using column filtering, the generated DB query will combine both the default filtering and what the
## user has entered in the column filters.
#set ($extra = 'AND doc.space <> :docapp_space')
#set ($params = {'docapp_space' : 'DocApp.Code'})
#if ("$!request.space" != '')
  #set ($extra = "${extra} AND doc.space = :doc_space")
  #set ($discard = $params.put('doc_space', $request.space))
#end
## Use filterLocation since addLivetableLocationFilter is buggy when called several times (it'll add the
## same HQL binding name every time it's called! See https://jira.xwiki.org/browse/XWIKI-17463).
## Also note that we
you don't call addLocationFilter since we use a Map for $params.
#filterLocation($
always need these extra features in your own LT , $params but you could so it would be best to make them reusable , $!request i . location, 'locationFilterValue1')
#if ("$!request
e . parent" != '')
  #set ($extra = "${extra} and doc
located inside XWiki . parent = :doc_parent")
  #set ($discard = $params.put('doc_parent', $request.parent))
#end
#if ("$!request.orphaned" == '1')
  #set ($homepage = $services.wiki.getById($services.wiki.currentWikiId).mainPageReference)
  #set ($homepageFullName = $services.model.serialize($homepage, 'local'))
  ## On Oracle the empty parent is actually null.
  #set ($extra = "${extra} and (doc.parent = '' or doc.parent is null) and doc.fullName &lt;&gt; :homepageFullName")
  #set ($discard = $params.put('homepageFullName', $homepageFullName))
#end
#gridresultwithfilter("$!request.classname" $request.collist.split(',') '' "${extra}" $params)
{{/velocity}}
{code}
LiveTableResultsMacros