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#HAllacceptedvalues > >> >> Hope this helps, >> Eduard >> >> ---------- >> [1] >> http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro#HParameter24options >> [2] >> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module#HFromVelocity >> [3] >> http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro#HParameter24columnsProperties >> [4] >> http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro#HFilterorganizationsbydomain >> >> 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@ >>> http://lists.xwiki.org/mailman/listinfo/users >>> >> >> > _______________________________________________ > users mailing list > users@ > http://lists.xwiki.org/mailman/listinfo/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'" }) #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.html Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users