Forums / Setup & design / How to sort a matrix at display ?
Sébastien Antoniotti
Tuesday 12 December 2006 5:14:53 am
Hi,
I'm looking for a solution to sort a matrix on a column (alphabetical sort on the name by exemple), but I don't found anything in the documentation and forum...
Did someone has an idea ?
eZ Publish Freelance web : http://www.webaxis.fr
Xavier Dutoit
Tuesday 12 December 2006 10:32:44 am
Salut,
Have a look at this extension, might be what you're looking for:
http://ez.no/community/contribs/template_plugins/sortable_ezmatrix_datatype
http://www.sydesy.com
Tuesday 12 December 2006 11:00:38 am
Thanks for your help, I have seen this contrib, but it seems that she don't sort the php array, she display the ezmatrix in her default order, and then she add buttons to sort it with javascript.
I just want to display my matrix in a classic html table, but before looping into, I want to sort it on a column.
I hope someone will understand me... lol
Claudia Kosny
Wednesday 13 December 2006 12:04:18 pm
Hi Sebastien
As far as I know there is no built in way to sort an ezmatrix. If you know PHP though it is fairly easy to write a template operator that takes an ezmatrix and a column name as input and returns a sorted 2 dimensional array - just grab the values of the matrix, put them into an 2 dimensional array and use e.g. usort() to sort by the specified column.
Good luck
Claudia
Wednesday 13 December 2006 12:51:08 pm
Hi Claudia,
Thanks a lot for your input, I think I'll try like this !
thanks again =)