So you don't do *any* sorting in your gateways?  Or, do you perform a
commonly-used sort, then, if needed, re-sort the results using a QoQ?

This is interesting since, if you you sort multiple ways, you could
potentially have multiple methods for the sorting.

However, I think this is bad:
getUsersSortedByLastFirst()
getUsersSortedByFirstLast()
getUsersSortedByUsername()

I guess it would be highly encapsulated, but what a disaster to
maintain.

I like the notion of QoQ in the view.  The sort order really has nothing
to do with the model or controller, but only in the view.

Comments?  BTW, I probably would not use Javascript for sorting.

M!ke 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, November 23, 2005 2:09 PM
To: [email protected]
Subject: [CFCDev] Sorting results

Under an MVC design is there any best place to sort results?  My natural
inclination is to say this would occur at the view stage since a
particular sorted order is most appropriate to how and why the user is
viewing the data.  The model shouldn't care about the order of things.

Generally I accomplish this by running a query of a query in the view or
controller before display.

<cfquery dbtype="query" name="sortedQuery"> select * from myQuery order
by #sortOrder# </cfquery>


I've also been using table sorting javascript to reorder the table
rather than performing a page refresh.

More recently I've been returning unsorted arrays of objects instead of
queries.  This means when the page first loads it is unsorted and a
javascript call must be made to sort it.


Any comments on this technique?


Jason Cronk


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to