Well - here is what I have done. It can certainly cleaned up - but I
haven't gotten to it. (Maybe a project for today.)
This one allows sorting by "Term" - or "letter" As well as Column Name ASC
and DSC (It allows me to get only Last Names starting with "x" and sort that
by whatever, email, added, posts, etc.)
<cfquery name="qryGetEmailSubscribers" datasource="#datasource#"
username="#username#" password="#password#">
SELECT EmailSubscribers.*
FROM EmailSubscribers
<cfif IsDefined("URL.Term") AND #URL.Term# NEQ "">
WHERE LastName Like "#URL.Term#%"
<cfif IsDefined("URL.SORT")>
ORDER BY #URL.SORT# #URL.Order#
<cfelse>
ORDER BY LastName ASC
</cfif>
<cfelse>
<cfif IsDefined("URL.SORT")>
ORDER BY #URL.SORT# #URL.Order#
<cfelse>
ORDER BY LastName ASC
</cfif>
</cfif>
</cfquery>
Example Links:
So for the term letters - I list each letter of the alphabet and link as
follows:
<a href="#CurrentPage#?Term=d">D</a>
For the each of the Column Heads I want to sort I have the following:
<th><a href="email_subscribers_list.cfm?Sort=LastName&Order=<cfif
IsDefined("URL.Order") AND URL.Order EQ "ASC">DESC<cfelse>ASC</cfif><cfif
IsDefined("URL.Term")>&Term=<cfoutput>#URL.Term#</cfoutput></cfif>" ><font
color="#333333">Name</font><cfif ISDefined("URL.Sort") AND URL.Sort EQ
"LastName"><cfif URL.Order EQ "ASC"><img src="images/icon_sort_asc.gif"
border="0"><cfelse><img src="images/icon_sort_desc.gif"
border="0"></cfif></cfif></a></th>
As I said - it can use some simplifying - but it works and should give you a
start.
- Nick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2967
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15