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