Re: Sorting by Column Headers
>Great suggestions...I almost have the Method=Get working... > >I like that idea about using JS to do it client side though also. >I'll look into that. > >Thanks >Rick There's a really nice Javascript library that does sortable tables. It is very unobstrusive and quite simple to set up - just set up a css style called sortable, add the library to your page, then give the table an id and use the css class with it. That's it. I've used it a number of times it works really well. Here' the url for the code: http://kryogenix.org/code/browser/sorttable/ hth, larry -- Larry C. Lyons Web Analyst BEI Resources American Type Culture Collection http://www.beiresources.org email: llyons(at)atcc(dot)org tel: 703.365.2700.2678 -- ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250852 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Sorting by Column Headers
If you've got a query like that, why store it in the SESSION? Store it in the Application scope. Store it once and you're done. -Original Message- From: Jeff Guillaume [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 3:11 PM To: CF-Talk Subject: Re: Sorting by Column Headers Storing the results in SESSION is a nifty (and fast) method, but I'd only recommend it if you know your result sets will always be relatively small. You don't want 100 people caching a resultset of, say, 10,000 rows of data. You'll run into memory issues. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250848 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Sorting by Column Headers
holy paranoia batman, that sounds scary! checkout this from the redballoon folks http://labs.redbd.net/blog/index.cfm/2006/8/8/Open-Source-Datagrid nice html based datagrid easily built in a few minutes using customtags. Has sorting, linking and filtering all in one simple ba! DK http://www.cubicleman.com On 8/23/06, Jeff Guillaume <[EMAIL PROTECTED]> wrote: > > Storing the results in SESSION is a nifty (and fast) method, but I'd only > recommend it if you know your result sets will always be relatively > small. You don't want 100 people caching a resultset of, say, 10,000 rows > of data. You'll run into memory issues. > > ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250805 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Sorting by Column Headers
>>only recommend it if you know your result sets will always be relatively small. Better store the form fields in the session anyway: if not isDefined ("url.sortBy") Store the form structure in a session variable else restore the form structure from the session variable endif run the query -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250802 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Sorting by Column Headers
Great suggestions...I almost have the Method=Get working... I like that idea about using JS to do it client side though also. I'll look into that. Thanks Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250798 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Sorting by Column Headers
Storing the results in SESSION is a nifty (and fast) method, but I'd only recommend it if you know your result sets will always be relatively small. You don't want 100 people caching a resultset of, say, 10,000 rows of data. You'll run into memory issues. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250791 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Sorting by Column Headers
The quickest fix would be to pass your search parameters on the URL instead of FORM (action="get" instead of action="post" from the submitting page). Then grab the current URL, minus the sort parameter, to re-use for the next output. Category .etc. This will retain the search parameters (since they're on the URL). ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250790 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Sorting by Column Headers
Everett, Al (NIH/NIGMS) [C] wrote: > Well, yeah, because the form variables don't exist because you're not > submitting a form. > > There are a couple of ways I would attack this: > > 1. Cache the initial query to the session scope. Then do a query of > query to sort when one of the headers is clicked. > > 2. Have the form use method="get" so that query criteria are in the URL, > use URL variables in the query, and adjust the links in the headers to > include the initial criteria. > > Option 1 is best, I think, because it only has one trip to the database > per search. > 3. Google on "javascript sort table" and find a script to do the sorting client side. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250789 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Sorting by Column Headers
It also wouldn't hurt to reference url.sortby instead of having it scope hunt. -Robert -Original Message- From: Everett, Al (NIH/NIGMS) [C] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 2:55 PM To: CF-Talk Subject: RE: Sorting by Column Headers Well, yeah, because the form variables don't exist because you're not submitting a form. There are a couple of ways I would attack this: 1. Cache the initial query to the session scope. Then do a query of query to sort when one of the headers is clicked. 2. Have the form use method="get" so that query criteria are in the URL, use URL variables in the query, and adjust the links in the headers to include the initial criteria. Option 1 is best, I think, because it only has one trip to the database per search. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250788 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Sorting by Column Headers
I have a search results page where I am using the column headers as way to sort. Each time you click to header, it runs the query again and appends the URL to something like searchresults.cfm?SortBy=Price. However, once you sort by Column Header, it returns ALL the rows, not just the results of the intial search (where you might be filtering by Price, Category, Size, etc). Below is the relevant code: SELECT P.ProdID, P.Designer, P.DressSize, P.Price, C.Category, C.CatID FROM Products P JOIN Category C ON P.CatID = C.CatID WHERE 0=0 AND Designer LIKE '%#FORM.Designer#%' AND DressSize LIKE '%#FORM.DressSize#%' AND Price <= #FORM.Price# AND C.CatID = #FORM.CatID# ORDER BY #sortBy# Categorytd> Designer Size I know I'm missing something simple... Thanks Rick ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250785 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Sorting by Column Headers
Well, yeah, because the form variables don't exist because you're not submitting a form. There are a couple of ways I would attack this: 1. Cache the initial query to the session scope. Then do a query of query to sort when one of the headers is clicked. 2. Have the form use method="get" so that query criteria are in the URL, use URL variables in the query, and adjust the links in the headers to include the initial criteria. Option 1 is best, I think, because it only has one trip to the database per search. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250787 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Sorting By Column
Allow your code to accept the sort/filter variables as form or url variables. For example, something like: SELECT col1, col2 FROM table WHERE col1 = '#FORM.Filter#' ORDER BY #FORM.Sort# Col1 Col2 ... display rows based on query ... -- 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/cf-talk@houseoffusion.com/ > 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/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
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/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists