I'm guessing the Javascript automatically assigns new values
to the hidden field for seq for each paragraph upon reordering?

I've thought about a JS solution, especially with jQuery, but
I'm finding myself bringing in so many JS solutions, that keeping
up with them is getting to be a chore.

I guess this one would be important enough to use, especially since
it seems to be the most intuitive for the user interface.  That aspect
alone could save me many support calls...

Thanks, Claude!

Rick

> -----Original Message-----
> From: Claude Schneegans [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 13, 2008 9:44 AM
> To: CF-Talk
> Subject: Re: Best way to order appearance of database content...
> 
>  >>Would this be the best way to do this?  Other ways?
> 
> In my CMS, there are several items the user can choose the order he
> wants, ie. paragraphs in a page.
> In order to do so, he has a list of all of them and he can move them up
> or down (Javascript).
> On submit, a list of items is created in order chosen by the user, in a
> hidden field.
> In the table, each item has a column "seq" for a sequence number.
> In the update template, I simply update all sequence numbers in a loop, ie:
>     <CFSET seq = 1>
>     <CFLOOP INDEX="paraId" LIST="#listPara#">
>         <CFQUERY DATASOURCE=#application.applicationName#>
>             UPDATE paragraphs SET
>                 seq = #seq#
>             WHERE paraId = #paraId#
>         </CFQUERY>
>         <CFSET seq = seq+1>
>     </CFLOOP>
> 
> Then use the seq column to sort by your queries.
> It may be a little more overhead on the database, but for items in small
> numbers (say less than 1000),
> it is marginal.
> And it is much simpler to handle than leaving holes between numbers and
> eventually renumber items
> any way when there are no more holes left.
> 
> --
> _______________________________________
> REUSE CODE! Use custom tags;
> See http://www.contentbox.com/claude/customtags/tagstore.cfm
> (Please send any spam to this address: [EMAIL PROTECTED])
> Thanks.
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

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

Reply via email to