If you use a custom results page (MySpace.MyJSON) then *you* are
responsible for implementing the live table sort and filter. You even
have a TODO for this in your code

## TODO: Add code to filter data

so I don't understand what you're asking. Of course the sort and
filter don't work. You need to implement them.

Hope this helps,
Marius


On Tue, Jun 16, 2015 at 10:25 AM,  <withwind...@gmail.com> wrote:
> Hi,
>
>   Everyone! My xwiki verison is 6.4.3. I want to use the Livetable macro to
> achieve to manage my table and paging it. But the table can not sort or
> filter,i really don’t know I was wrong, could you someguys help me? Here is
> my code:
>
>
>
>
>
> The page I use livetable code:
>
>
>
> {{velocity}}
>
> #set($columns = [ "user"  , "message" ])
>
> #set($columnsProperties = {
>
>     "user" : { "type" : "text" },
>
>     "message" : { "type" : "text"}
>
> })
>
>
>
> #set($options = {
>
>     "resultPage":"MySpace.MyJSON"
>
> })
>
>
>
> #livetable("twitter" $columns $columnsProperties $options)
>
> {{/velocity}}
>
>
>
> MySpace. MyJSON:
>
> {{velocity wiki="false"}}
>
> #if("$!{request.xpage}" == 'plain')
>
>   $response.setContentType('application/json')
>
> #end
>
> ##==============================
>
> ## Offset = item # at which to start displaying data
>
> ##==============================
>
> #set($offset = $util.parseInt($request.get('offset')))
>
> ## offset starts from 0 in velocity and 1 in javascript
>
> #set($offset = $offset - 1)
>
> #if($offset < 0)
>
>   #set($offset = 0)
>
> #end
>
> ##==================
>
> ## Limit = # of items to display
>
> ##==================
>
> #set($limit = $util.parseInt($request.get('limit')))
>
> ##==================
>
> ## Tag = one parameter per tag
>
> ##==================
>
> #if($request.tag)
>
>   #foreach($tag in $request.getParameterValues('tag'))
>
>     ## TODO: Add code to filter items based on the selected tags
>
>   #end
>
> #end
>
> ##==========
>
> ## Sort direction
>
> ##==========
>
> #set($order = "$!request.sort")
>
> #if($order != '')
>
>   #set($orderDirection = "$!{request.get('dir').toLowerCase()}")
>
>   #if("$!orderDirection" != '' && "$!orderDirection" != 'asc')
>
>     #set($orderDirection = 'desc')
>
>   #end
>
> #end
>
> ## ===========
>
> ## Filter Data here...
>
> ## ===========
>
> ## TODO: Add code to filter data
>
> ## Each column can be filtered and the filter for a column can be retrieved
> with:
>
> ## #set($filterValue = "$!{request.get(<columnname>)}")
>
>
>
> ## ===
>
> ## JSON
>
> ## ===
>
> {
>
> "totalrows": 2,
>
> "matchingtags": {},
>
> "tags" : [],
>
> "returnedrows":  2,
>
> "offset": 1,
>
> "reqNo": $util.parseInt($request.reqNo),
>
> "rows": [{
>
>   "doc_viewable" : true,
>
>   "user" : "vincent",
>
>   "message" : "vincent's message"
>
> },{
>
>   "doc_viewable" : true,
>
>   "user" : "jack",
>
>   "message" : "jack's message"
>
> }]
>
> }
>
> {{/velocity}}
>
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to