Nope.

sort only works for 2 dimensional arrays.

You'd need to use array_multisort

I guess you'd do something like...

// get resultset from doctrine/propel as $resultset
$sortable = new array();
foreach ($resultset as $row) {
   $sortable[] = $row;
}

$this->results = array_multisort($sortable, $sortable[$request- 
 >getParam('column'), $request->getParam('sort_order'));

Don't forget you need to maintain state of how many clicks on the  
column header (so you know what order to order, or to cancel ordering)  
and also you need to keep state of the last query, and the page within  
those results.

I'd also think about making the table a partial, which should speed  
things up a bit - you'd just be regenerating the table then, not the  
whole page.

I can understand why you need to do this, but still think it's a bad  
idea.

On 12 Jan 2009, at 01:42, Calvin Jeong wrote:

>
> Use `sort` function?
>
> On 12/01/2009, at 12:41 PM, Adrian Gould wrote:
>>
>> Any pointers on creating a data table with the headings having links
>> that sort the data when clicked.
>> NO JAVASCRIPT
>> SERVER SIDE SORTING

Lee Bolding
[email protected]

"a successful framework finds users and sucks and diddles their  
genitalia, it doesnt bend them over and make them squeel like stuck  
pigs." Hani Suleiman, The Bile Blog


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to