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.

eZ debug

Timing: Jan 18 2025 02:08:34
Script start
Timing: Jan 18 2025 02:08:34
Module start 'layout'
Timing: Jan 18 2025 02:08:34
Module start 'content'
Timing: Jan 18 2025 02:08:36
Module end 'content'
Timing: Jan 18 2025 02:08:36
Script end

Main resources:

Total runtime1.4005 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.0313152.6406
Module start 'layout' 0.00570.0035 740.671939.4609
Module start 'content' 0.00921.3899 780.1328524.8203
Module end 'content' 1.39910.0013 1,304.95318.1406
Script end 1.4004  1,313.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2275160.0002
Check MTime0.00130.0957160.0001
Mysql Total
Database connection0.00070.050210.0007
Mysqli_queries1.356796.8786540.0251
Looping result0.00120.0827520.0000
Template Total1.370997.920.6854
Template load0.00220.155620.0011
Template processing1.368797.732920.6844
Template load and register function0.00020.012510.0002
states
state_id_array0.00090.064110.0009
state_identifier_array0.00120.087520.0006
Override
Cache load0.00170.1226160.0001
Sytem overhead
Fetch class attribute can translate value0.00070.046520.0003
Fetch class attribute name0.00120.088030.0004
XML
Image XML parsing0.00050.038420.0003
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00080.0567160.0000
String conversion0.00000.001440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs