Thanks Jim! Appreciated... 

-----Original Message-----
From: Jim Davis [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 20, 2007 11:40 AM
To: CF-Talk
Subject: RE: CF Sorting Code...

> -----Original Message-----
> From: Che Vilnonis [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 20, 2007 9:02 AM
> To: CF-Talk
> Subject: CF Sorting Code...
> 
> I've seen this before but I can't seem to find it on the Adobe 
> exchange. I'm looking for a custom tag or any kind of CF code that can 
> take a list of database entries and allow you to sort them "visually", 
> by cliking on a product and moving it up or down. Thanks, Che.

This wouldn't really be CF Code (although CF could definitely deliver it).
You'd need to do this primarily on the client side.

I've an example here using JavaScript and my "ObCollectionOrdered" object:

http://www.depressedpress.com/Content/Development/JavaScript/Extensions/DP_O
bCollectionOrdered/Index.cfm

Go down to "examples" and look at the first one.  The code is stand alone
but in your case you would replace lines 44-50 with CF output of your items.
Bascially your creating a collection of "Option" objects and a simple method
to populate them into a select box (the populateSelect() box function in the
example).

The ObCollectionOrdered extension then provides all sorts of ways to
manipulate the ordered collection - moving items (promoting/demoting/jumping
to a position/first/last/etc) and sorting.  You just manipulate the
collection using those (usually just one method call) and then just recall
the populateSelect() to paint the select with the new order.

Essentially all your code does is paint the screen and call methods on the
collection.

The whole idea is easily transferred to other displays as well (there's
another example of using the same thing to create sortable tables for
example).

Hope this helps,

Jim Davis




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 beta – Build next generation applications today.
Free beta download on Labs
http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284215
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to