Hi,
Table filtering can only work with data available on the page,so you can
only do that with small volumes of data and need to make sure everything
is there.
This is why we moved away from that to do LiveTables. They can handle
very big amount of data with both filtering and pagination.
As you date is in a XWiki.Todo2Class you should be able to have select
filter boxes for fields that are List fields
Ludovic
Le 30/06/10 11:56, Aleks87 a écrit :
I have to choose between the normal Table and the
Livetable.
I like the possibility to make select boxes with the normal table (using:
class="unsortable selectFilter")
But I have problems with the filtering. If I add pagination and use the
filter field he shows me only the results of the current page.
Livetable finds all pages but I can't make such Filter-Boxes.
Please tell me if I did something wrong with the normal table!
Here is my code:
## The full data to display
#set ($spaceDocs = $xwiki.getSpaceDocsName("Projects-Todo"))
#set($itemsPerPage = 3)
#if($request.ipp)
#set($itemsPerPage = $xwiki.parseInt($request.ipp))
#end
#set($pageNumber = 0)
#if($request.page)
#set($pageNumber = $xwiki.parseInt($request.page))
#end
#set($startAt = $itemsPerPage * $pageNumber)
#if($startAt< 0)
#set($startAt = 0)
#end
#set($endAt = $itemsPerPage * ($pageNumber + 1))
#if($endAt> $spaceDocs.size())
#set($endAt = $spaceDocs.size())
#end
#if($startAt> $endAt)
#set($startAt = $endAt)
#end
#set($totalPages = ($spaceDocs.size() - 1) / $itemsPerPage)
#set($crtPageNumber = $startAt / $itemsPerPage)
#set($spaceDocsInPage = $spaceDocs.subList($startAt, $endAt))
#set ($hql = ", BaseObject as obj where obj.name=doc.fullName
and obj.className='XWiki.Todo2Class' and
obj.name<>'XWiki.Todo2Template'
order by doc.date desc")
#set ($todos= $xwiki.searchDocuments($hql, $itemsPerPage, $startAt))
<table id="todoTable" class="grid sortable filterable doOddEven"
cellpadding="0" cellspacing="0" border="0">
<tr class="sortHeader">
<th>Page</th>
<th>Description</th>
<th class="unsortable selectFilter">Priority</th>
<th class="unsortable selectFilter">Status</th>
<th>Date</th>
</tr>
#foreach ($todo in $todos)
<tr>
#set ($todoDoc = $xwiki.getDocument($todo))
#set ($todoObj = $todoDoc.getObject("XWiki.Todo2Class"))
<td>[$todo]</td>
<td>$todoObj.Description</td>
<td>$todoObj.Priority</td>
<td>$todoObj.Status</td>
<td>$todoObj.Date</td>
</tr>
#end
</table>
--
Ludovic Dubost
Blog:
http://blog.ludovic.org/
XWiki:
http://www.xwiki.com
Skype: ldubost GTalk: ldubost