[xwiki-users] Help with Live Table and Grid Component
I'm trying to create a live table similar to the "All Docs" one in Main, but filtered for a specific space (in this case, named Software). i've used the Live table snippet for the table page itself: ------------------------------------------- {{velocity}} #set($collist = ["doc.name", "doc.space","doc.date", "doc.author", "_actions"]) #set($colprops = { "doc.name" : { "type" : "text" , "size" : 30, "link" : "view"}, "doc.space" : { "type" : "text", "link" : "space"}, "doc.date" : { "type" : "date" }, "doc.author" : { "type" : "text", "link" : "author"}, "_actions" : {"actions": ["copy","delete","rename","rights"]} }) #set($options = { "resultPage":"XWiki.SofwareTableresults", "translationPrefix" : "xe.index.", "rowCount": 15 }) #livetable("allsoftwaredocs" $collist $colprops $options) {{/velocity}} ------------------------------------------- And here's the Software table results page: ------------------------------------------- {{include document="XWiki.LiveTableResultsMacros" /}} {{velocity}} #set($extra = "") #if("$!request.space" != "") #set($extra = "${extra} and doc.space = '$request.space'") #end #if("$!request.orphaned" == "1") #set($extra = "${extra} and doc.parent='' and doc.name<>'WebHome'") #end #gridresultwithfilter("$!request.classname", $request.collist.split(","), "doc.space = 'Software' ", "${extra}") {{/velocity}} ------------------------------------------- As soon as I added the ""doc.space = 'Software' " parameter to the gridresultfilter(), it broke the page and gives: "Failed to execute macro: velocity" What is the correct way to filter the query? Thanks, - James Cuzella
Hi James, On 06/08/2010 05:08 AM, James Cuzella wrote:
I'm trying to create a live table similar to the "All Docs" one in Main, but filtered for a specific space (in this case, named Software).
i've used the Live table snippet for the table page itself:
------------------------------------------- {{velocity}} #set($collist = ["doc.name", "doc.space","doc.date", "doc.author", "_actions"]) #set($colprops = { "doc.name" : { "type" : "text" , "size" : 30, "link" : "view"}, "doc.space" : { "type" : "text", "link" : "space"}, "doc.date" : { "type" : "date" }, "doc.author" : { "type" : "text", "link" : "author"}, "_actions" : {"actions": ["copy","delete","rename","rights"]} }) #set($options = { "resultPage":"XWiki.SofwareTableresults", "translationPrefix" : "xe.index.", "rowCount": 15 }) #livetable("allsoftwaredocs" $collist $colprops $options) {{/velocity}} -------------------------------------------
And here's the Software table results page: ------------------------------------------- {{include document="XWiki.LiveTableResultsMacros" /}}
I don't know much about live table but the code below was already filtering by space if the space name was present on the request (i.e. if the page was called with space=SomeSpace in the query string). It looks like you can specify query string parameters using the "extraParams" live table option ( http://code.xwiki.org/xwiki/bin/view/Macros/LiveTableMacro ). So you should try using the default data source (XWiki.LiveTableResults) with extra query string parameters: #set($options = { "extraParams":"space=Software", "translationPrefix" : "xe.index.", "rowCount": 15 }) (of course, this code should be place in the table page, before the call to livetable macro) Hope this helps, Marius
{{velocity}} #set($extra = "") #if("$!request.space" != "") #set($extra = "${extra} and doc.space = '$request.space'") #end #if("$!request.orphaned" == "1") #set($extra = "${extra} and doc.parent='' and doc.name<>'WebHome'") #end #gridresultwithfilter("$!request.classname", $request.collist.split(","), "doc.space = 'Software' ", "${extra}") {{/velocity}} -------------------------------------------
As soon as I added the ""doc.space = 'Software' " parameter to the gridresultfilter(), it broke the page and gives: "Failed to execute macro: velocity"
What is the correct way to filter the query?
Thanks, - James Cuzella _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On Tue, Jun 8, 2010 at 12:14 AM, Marius Dumitru Florea <[email protected]> wrote:
I don't know much about live table but the code below was already filtering by space if the space name was present on the request (i.e. if the page was called with space=SomeSpace in the query string). It looks like you can specify query string parameters using the "extraParams" live table option ( http://code.xwiki.org/xwiki/bin/view/Macros/LiveTableMacro ). So you should try using the default data source (XWiki.LiveTableResults) with extra query string parameters:
#set($options = { "extraParams":"space=Software", "translationPrefix" : "xe.index.", "rowCount": 15 })
(of course, this code should be place in the table page, before the call to livetable macro)
Hope this helps, Marius
I tried this, however it didn't quite work. I did end up looking further at the live table parameters on the page you referenced and found another way. I used the "topFilters" parameter to add my own hidden input box to be used as a filter for the livetable: #set($options = { "topFilters":'<input type="hidden" title="Filter Software Space" size="${colprop.size}" name="doc.space" id="xwiki-livetable-allsoftwaredocs-filter-5" value="Software" />', "translationPrefix" : "xe.index.", "rowCount": 15 }) Thanks, - James Cuzella
participants (2)
-
James Cuzella -
Marius Dumitru Florea