Allow your code to accept the sort/filter variables as form or url
variables. For example, something like:
<CFPARAM NAME="URL.Sort" DEFAULT="">
<CFPARAM NAME="FORM.Sort" DEFAULT="#URL.Sort#">
<CFPARAM NAME="URL.Filter" DEFAULT="">
<CFPARAM NAME="FORM.Filter" DEFAULT="#URL.Filter#">
<CFQUERY NAME="GetRecords" DATASOURCE="#APPLICATION.DSN#">
SELECT
col1,
col2
FROM
table
<CFIF Len(Trim(FORM.Filter))>
WHERE
col1 = '#FORM.Filter#'
</CFIF>
<CFIF Len(Trim(FORM.Sort))>
ORDER BY #FORM.Sort#
</CFIF>
</CFQUERY>
<TABLE>
<TR>
<TD><A
HREF="currentPage.cfm?Filter=#FORM.Filter#&Sort=col1">Col1</A></TD>
<TD><A
HREF="currentPage.cfm?Filter=#FORM.Filter#&Sort=col2">Col2</A></TD>
</TR>
<CFOUTPUT QUERY="GetRecords">
... display rows based on query ...
</CFOUTPUT>
</TABLE>
--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 625-9191
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/
> -----Original Message-----
> From: David Sampson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 26, 2002 2:20 PM
> To: CF-Talk
> Subject: Sorting By Column
>
>
> Earlier this week someone posted a link to Web Tricks
> (http://www.webtricks.com/) for help with sorting an output table by
> columns. Great little application! Works fine! Thanks!
>
> But... (you had to know there was a 'but'). When I query by a
> variable; get
> a table of results; then, try to sort (using my newly installed
> sort-by-column links), the entire page is reloaded, the query is run again
> (this time without the form.variable) and the whole database is output!
>
> How can I get it to sort by column using the variables originally passed?
>
> David Sampson
> Analyst/Programmer II
> AK Department of Education & Early Development
> 907.465.2395 ph 907.465.8676 fx
> [EMAIL PROTECTED]
>
> FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
>
>
>
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists