Hi,
On Thu, Feb 25, 2016 at 3:26 PM, pgregoire <pgregoire(a)eddyfi.com> wrote:
Eduard Moraru wrote
On Thu, Feb 25, 2016 at 12:31 PM, Eduard Moraru
<
enygma2002@
>
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@
> 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@
_______________________________________________
users mailing list
users@
Hello,
thanks for the help.
Indeed what I want to do is the "B" option.
As you can read from the LiveTable Macro's
documentation [1], the
"queryFilters" parameter is used to specify which (already registered)
query filter name
I think the documentation is missing the (already registered) part - this
is
what threw me off. I suspected it was something like this too, but could
not
figure out how to register a filter.
Now it does look like the extraParams option is what I'm looking for, but I
can't get that to work either.
The documentation says
"all the objects that have a specific value for a property ("extraParams"
:
"&yourProperty=yourValue" - note that in this particular case,
yourProperty
has to be declared in the $columns array). "
Here's what I did:
#set($columns = ["Version", "Name", "ReleaseDate"])
#set($columnsProperties = {
"Name": { "link" : "none" }
})
#set($options = {
"className":"Development.Resources.Version
Information.VersionInformationClass",
"tagCloud" : true,
"rowCount": 20,
"extraParams" : "&Version='4.0'"
You need to be aware that these paremeters are actually URL parameters that
are sent to the livetable results page with javascript (when loading the
livetable, switching to the next page, filtering, etc.), so you don`t need
to quote the value.
Assuming that "Version" is indeed the name of the property you want to
filter by (and it's not the pretty name of the property; please check that.
It would usually be lowercase. It needs to match both the class property
name and the column name), it should just be:
"extraParams" : "&Version=4.0"
Note: If you need to have more complicated values in the extraParams
option, you will need to escape the values by hand.
Example:
"extraParams" :
"&$name1=$escapetool.url($value1)&name2=$escapetool.url($value2)",
where
$valueN would be "Value/with?URL&specific%characters".
Thanks,
Eduard
})
#livetable("4_0_VersionInformation" $columns
$columnsProperties $options)
Which would seem like it follows the documentation, but the list comes out
empty.
--
View this message in context:
http://xwiki.475771.n2.nabble.com/How-to-filter-livetable-tp7598115p7598127…
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