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

Reply via email to