Hello tomasg,

If you want to have dynamic sorting and filtering, you should rather
use the LiveTable component/macro

Checkout :
* http://code.xwiki.org/xwiki/bin/view/Macros/LiveTableMacro
* http://platform.xwiki.org/xwiki/bin/view/DevGuide/LiveTable

Cheers,
Jérôme

On Tue, Nov 30, 2010 at 1:17 PM, tomasg <[email protected]> wrote:
>
> Hello, I would like to know whether is possible refresh table data when I
> change column for sorting.
> Now, when I click to sort by some column, table is sorted with actual table
> data, not with all data. I expect that is needed to add "order by" to sql
> query, but what else should I add?
> If this is not possible could I use livetable with data from sql query?
>
> Thank you
>
>
> Here is my code:
>
> $xwiki.ssfx.use("js/xwiki/table/table.css")
> $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
>
> #connectDbTEP($dbc)
> #countRooms($pocetMistnosti)
>
> #set($paginationParameters = {
>    'totalItems' : $pocetMistnosti,
>    'defaultItemsPerPage' : 15,
>    'url' : $doc.getURL('view', $queryParams)
>  })
>  #pagination($paginationParameters)
>
> <table  id="searchResults" class="grid sortable doOddEven">
>  <tr class="sortHeader">
>    <th>Místnost</th>
>    <th>Zodpovědná osoba</th>
>    <th class="unsortable">Operace</th>
>   </tr>
>
>   #foreach($row in $dbc.executeQuery("select id_room, mistnost, prijmeni,
> jmeno from room, osoby where room.id_os = osoby.id_os limit
> $paginationParameters.firstItem, $paginationParameters.itemsPerPage"))
>   <tr>
>    <td> $row.getString("mistnost") </td>
>    <td> $row.getString("prijmeni") $row.getString("jmeno")</td>
>    <td>
>       EditRoom?id_room=$row.getLong(
>       DeleteRoom?id_room=$row.getLong(
>    </td>
>   </tr>
>   #end
>   </table>
>
>  #set($discard = $paginationParameters.put('position', 'bottom'))
>  #pagination($paginationParameters)
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/Pagination-macro-with-sortable-table-tp5787879p5787879.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to