On Thu, Feb 25, 2016 at 12:31 PM, Eduard Moraru <enygma2002(a)gmail.com>
wrote:
Hi Phil,
As you can read from the LiveTable Macro's documentation [1], the
"queryFilters" parameter is used to specify which (already registered)
query filter name to use in the query that is performed by the backend of
the livetable macro that you are using. This is not the place where you
would add "WHERE" clauses, but it`s for the actual name of existing query
filters (e.g. "unique", "hidden", etc. See [2] 5th bullet).
I`m not sure where you`ve got that example livetable or that
"$4_0QueryFilter" variable.
Now, it also depends what you want to achieve, since it was not very clear
from your message.
A) If you want to expose in the livetable the column called "version"
which corresponds to the "version" field in an object of your class and
make that column filterable by users, then you need to use the
colmnProperties map and make sure your column has the "filterable" flag set
to "true". See [3] for more details.
B) If what you want to do is have the generated livetable be already
filtered to a specific value of your "version" property (e.g. show *only*
entries of version "1.0"), then you would need to create your custom
livetable results page where you would use the "#gridresultwithfilter"
velocity macro which allows in its 4th parameter to specify extra "WHERE"
clauses to use in the query it is performing. Finally, use the "resultPage"
parameter in your livetable display page to specify that you want to use
your custom livetable results page that you have just created. Again, you
have an example for this in the documentation [4].
Correction, for B), just use the "extraParams" option[5] of the livetable
macro to specify you extra "WHERE" clauses, no need to create a custom
results page.
I know there was one, I just could not find it at first :)
Thanks,
Eduard
[5]
http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro#HAllac…
Hope this helps,
Eduard
----------
[1]
http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro#HParam…
[2]
http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module#HFromVelo…
[3]
http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro#HParam…
[4]
http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro#HFilte…
On Wed, Feb 24, 2016 at 3:15 PM, pgregoire <pgregoire(a)eddyfi.com> wrote:
Hello,
I installed xwiki a few days ago and I'm still learning the ropes. I
created
a new class called VersionInformation with its associated template and
sheet.
I'm able to create objects and display them in a livetable, but I have a
hard time using the queryFilters option.
My class has a Version field which I'd like to filter on.
Here is my code:
{{velocity}}
#set($columns = ["Name", "CoreTag", "ReleaseDate"])
#set($columnsProperties = {
"Name": { "link" : "none" }
})
#set($options = {
"className":"Development.Resources.Version
Information.VersionInformationClass",
"tagCloud" : true,
"rowCount": 20,
"queryFilters" : $4_0QueryFilter
})
#livetable("4_0_VersionInformation" $columns $columnsProperties $options)
{{/velocity}}
I have no clue as to how the 4_0QueryFilter variable should be created.
I'm
guessing something along the lines of
#set($4_0_QueryFilter = $services.query.xwql("Version='4.0'") )
but that doesn't work. I tried other variations on that with a WHERE
statement, with the .execute() and so on but no success so far.
Can somebody help me out on this?
Thanks
Phil
--
View this message in context:
http://xwiki.475771.n2.nabble.com/How-to-filter-livetable-tp7598115.html
Sent from the XWiki- Users mailing list archive at
Nabble.com.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users