How to sort a fetched list ( client side )

Author Message

Jean Gaudel

Tuesday 14 September 2010 2:42:06 am

Hi All,

I'de like to create a list of objects sortable by the visitor.

I know the "sort_by" param of the fetch/content/list function. But how to use it with a client side choice ?

Thanks for your help !

Matthieu Sévère

Tuesday 14 September 2010 2:48:06 am

Hi !

You can use view_parameters to control to sort parameters of your fetch.

For example you can have a link that sort by date :

<a href={'Your/URLAlias/(sort)/date'|ezurl}>Sort By date</a>

By clicking on this link you will define a view_parameters sort with the value date

You can then retrieve this value in a template like this :

{def $sort_method = $view_parameters.sort}

--
eZ certified developer: http://ez.no/certification/verify/346216

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.