RE: Saving updated sort order in mysql jquery list to update database
If you want to build the array in jQuery then you can do something like the following: arIDs = new Array(); $(input[name='ID']).each(function(){ arIDs.push($(this).val()); }) David Phelan Web Developer IT Security Web Technologies Emerging Health Montefiore Information Technology 3 Odell Plaza, Yonkers, NY 10701 914-457-6465 Office 862-234-9109 Cell dphe...@emerginghealthit.com www.emerginghealthit.com www.montefiore.org -Original Message- From: te...@it-werks.com te...@it-werks.com [mailto:te...@it-werks.com] Sent: Wednesday, September 25, 2013 7:43 PM To: cf-talk Subject: Saving updated sort order in mysql jquery list to update database I have a cfm page that displays a drag and drop ul list and I do not know how to create an array of that sorted list to the mysql database. Any help would be greatly appreciated. I am new to the jquery, jquery-ui plugins, but loving it all so far. Thanks in advance, Terry ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356850 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Saving updated sort order in mysql jquery list to update database
I have a cfm page that displays a drag and drop ul list and I do not know how to create an array of that sorted list to the mysql database. Any help would be greatly appreciated. I am new to the jquery, jquery-ui plugins, but loving it all so far. Thanks in advance, Terry ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356843 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Saving updated sort order in mysql jquery list to update database
The callback called after you drop your sorted item should place an ajax call to your selected endpoint with a list of IDs in their new order. (I haven't used the jQuery UI sortables to know the details.) Then on the CF side just update the DB. A naive way might be like this: cfloop from=1 to=#listLen(IDs)# index=i UPDATE items SET sortOrder = cfqueryparam value=#i# CFSQLType=cf_sql_integer / WHERE (ID = cfqueryparam value=#listGetAt(IDs, i)# CFSQLType=cf_sql_idstamp /) /cfloop On 9/25/13 4:42 PM, te...@it-werks.com te...@it-werks.com wrote: I have a cfm page that displays a drag and drop ul list and I do not know how to create an array of that sorted list to the mysql database. Any help would be greatly appreciated. I am new to the jquery, jquery-ui plugins, but loving it all so far. Thanks in advance, Terry ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356844 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm