Thanx, Jeff - I knew there had to be a better way! I'll give it a whirl
Regards,
Chris
At 05:16 PM 4/19/00 -0400, you wrote:
>If you want it "cleaner", use a persistent structure. At least you won't
>have a bunch of hidden fields clogging up the FORM structure from page to
>page, it will execute a little faster as the data is in server memory and
>not being passed and parsed over and over...
>
>On the initial search page, make sure the structure is created and empty
>(nulled).
>
>On the results/re-search page:
>1)Check if the FORM structure is there (came from initial search page). If
>it exists, populate the structure with the FORM values.
>2)Default the SortBy field
>3)Perform the query using the structure's values.
>4)Make the column heading links to the same page and set the SortBy
>accordingly.
>
>If the FORM structure isn't present, then you know you came from the
>previous results/re-search page and don't need to parse the FORM fields to
>set up the query. You just re-execute the query with the new SortBy value.
>
>
>Alternatively, you could setup a JS array and populate it with the query's
>result and use JS code to re-order the list on the fly. The re-ordering is
>all done client-side. Cleaner, leaner, and less "stress" on the server since
>it only does the query once and the client is responsible for sorting and
>redrawing the output.
>
>Good luck!!
>
>On the initial search page, check for the structure and clear it.
>
>On the results/re-search page, check if the structure is empty and populate
>it if so; then use the structure to perform the query. On the header links,
>do what Curtis said and pass the OrderBy value on the URL of the link.
>
>-----Original Message-----
>From: Chris Geanious [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, April 19, 2000 3:29 PM
>To: [EMAIL PROTECTED]
>Subject: Sorting search results: revisited
>
>
>Further Greetings,
>So, thanking those who did respond to my original posting concerning
>sorting search results,
>This is what I ended up doing. Not elegant or very pretty but here goes:
>
>The problem: Search results produced by a dynamic query:
>
> <CFQUERY DATASOURCE="db" NAME="getcontact">
> SELECT
> Contact_Information.First_Name,
> Contact_Information.Last_Name,
> Contact_Information.Organization_Name,
> Contact_Information.Contact_ID,
> Contact_Information.City,
> Contact_Information.County
> FROM Contact_Information
> WHERE 1=0
> <CFIF IsDefined('FORM.First_Name')>
> <CFIF #First_Name# IS NOT "">
> OR First_Name = '#FORM.First_Name#'
> </CFIF>
> </CFIF>
> <!---snip--->
> <CFIF IsDefined('FORM.County')>
> <CFIF #FORM.County# IS NOT "">
> OR County = '#FORM.County#'
> </CFIF>
> </CFIF>
>
> <CFIF IsDefined('getid.Contact_ID')>
> <CFIF #getid.Contact_ID# IS NOT "">
> OR Contact_ID IN (#PreserveSingleQuotes(idList)#)
> </CFIF>
> </CFIF>
>
> ORDER BY "#OrderBy#"
> </CFQUERY>
>
>How to sort these by the variables in the query:
>
>In the results page the contacts are displayed tabularly with the <th>
>headings</th>
>a button with the heading name: ie: First Name, Last Name, City, etc.
>
><table border="1" width="100%">
> <tr>
> <th width="15%">
> <CFOUTPUT>
> <FORM ACTION="contsearch.cfm" METHOD="POST">
> <INPUT TYPE="hidden" NAME="First_name" VALUE="#form.First_Name#">
> <INPUT TYPE="hidden" NAME="Last_name" VALUE="#form.Last_Name#">
> <INPUT TYPE="hidden" NAME="Organization_name"
>VALUE="#Organization_Name#">
> <INPUT TYPE="hidden" NAME="City" VALUE="#City#">
> <INPUT TYPE="hidden" NAME="Zip_Code" VALUE="#Zip_Code#">
> <INPUT TYPE="hidden" NAME="County" VALUE="#County#">
> <INPUT TYPE="hidden" NAME="Contact_ID"
>VALUE="#PreserveSingleQuotes(idList)#">
> <INPUT TYPE="hidden" NAME="OrderBy" VALUE="First_Name">
> <INPUT TYPE="hidden" NAME="Classification_Code"
>VALUE="#Classification_Code#">
> <INPUT TYPE="SUBMIT" VALUE="First Name">
> </FORM>
> </CFOUTPUT>
> </th>
>
>Each belonging to a form which passes the query variables as hidden fields
>plus #OrderBy# as First Name, Last Name, City, etc.
>
>Works like a charm but not as pretty as sending everything along via WDDX,
>I guess.
>
>Would still be interested if someone had a niftier way...
>----------------------------------------------------------------------------
>--
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>------------------------------------------------------------------------------
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.