I have a table where I can click the headers to sort the whole table by different columns. I would like to incorporate some boolean state so that I can click once to sort the table by that column ascending then click again to have it descending.
Here is my code:
<th><A HREF="thispage.cfm?sorter=creationDate">Creation Date</A> </th>
<cfif IsDefined("URL.sorter")>
<cfquery datasource="Pad" name="One">
select * from meeting
ORDER BY #URL.sorter# DESC
</cfquery>
<cfelse>
<cfquery datasource="Pad" name="One">
select * from meeting
ORDER BY contactName
</cfquery>
</cfif>
I believe it could be implemented by creating a boolean variable using cfset and then altering that variable state on clicking the table header and assigning one variable state to ASC and another to DESC in the first query. I'm just not sure how to implement it.