<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: CakePHP: Sortable AJAX Drag &amp; Drops &#8211; The Basics</title>
	<atom:link href="http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/</link>
	<description>Dustin Weber's Take On Web Development &#038; Other Random Diversions.</description>
	<lastBuildDate>Sun, 14 Mar 2010 20:08:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Felix</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-826</link>
		<dc:creator>Felix</dc:creator>
		<pubDate>Tue, 17 Nov 2009 19:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-826</guid>
		<description>Hi, I have exactly the same problem as ray, everything appears to be working but the order function just doesn&#039;t get called.

Can any one suggest what the problem could be?

Thanks,
Felix</description>
		<content:encoded><![CDATA[<p>Hi, I have exactly the same problem as ray, everything appears to be working but the order function just doesn&#8217;t get called.</p>
<p>Can any one suggest what the problem could be?</p>
<p>Thanks,<br />
Felix</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ray</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-768</link>
		<dc:creator>ray</dc:creator>
		<pubDate>Fri, 27 Mar 2009 05:58:15 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-768</guid>
		<description>i need some help...

my function order() is not getting called...so the drag and drop is working but not getting saved....

here is my code in the view:

sortable(&#039;widgets&#039;, array(&#039;url&#039;=&gt;&#039;order&#039;, &#039;before&#039;=&gt;&quot;Element.hide(&#039;status&#039;);&quot;, &#039;complete&#039;=&gt;&quot;Element.show(&#039;status&#039;);&quot;)); ?&gt;


set(&#039;status&#039;, &#039;Artist Ordering Succesfully Saved!&#039;);

//assign widgets to view sorted by the &#039;order&#039; field
$this-&gt;set(&#039;widgets&#039;, $this-&gt;Widget-&gt;findAll(null,null,&#039;order&#039;,null,null));


/** Receives ajax request from index **/

}// end of index

function order()
{

//loop through the data sent via the ajax call
foreach ($this-&gt;params[&#039;form&#039;][&#039;widgets&#039;] as $order =&gt; $id)
{
$data[&#039;Widget&#039;][&#039;order&#039;] = $order;

$this-&gt;Widget-&gt;id = $id;
$this-&gt;Widget-&gt;saveField(&#039;order&#039;,$order);
//we have success!

} // foreach loop

} // end of function order



}</description>
		<content:encoded><![CDATA[<p>i need some help&#8230;</p>
<p>my function order() is not getting called&#8230;so the drag and drop is working but not getting saved&#8230;.</p>
<p>here is my code in the view:</p>
<p>sortable(&#8216;widgets&#8217;, array(&#8216;url&#8217;=&gt;&#8217;order&#8217;, &#8216;before&#8217;=&gt;&#8221;Element.hide(&#8217;status&#8217;);&#8221;, &#8216;complete&#8217;=&gt;&#8221;Element.show(&#8217;status&#8217;);&#8221;)); ?&gt;</p>
<p>set(&#8217;status&#8217;, &#8216;Artist Ordering Succesfully Saved!&#8217;);</p>
<p>//assign widgets to view sorted by the &#8216;order&#8217; field<br />
$this-&gt;set(&#8216;widgets&#8217;, $this-&gt;Widget-&gt;findAll(null,null,&#8217;order&#8217;,null,null));</p>
<p>/** Receives ajax request from index **/</p>
<p>}// end of index</p>
<p>function order()<br />
{</p>
<p>//loop through the data sent via the ajax call<br />
foreach ($this-&gt;params['form']['widgets'] as $order =&gt; $id)<br />
{<br />
$data['Widget']['order'] = $order;</p>
<p>$this-&gt;Widget-&gt;id = $id;<br />
$this-&gt;Widget-&gt;saveField(&#8216;order&#8217;,$order);<br />
//we have success!</p>
<p>} // foreach loop</p>
<p>} // end of function order</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ray</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-767</link>
		<dc:creator>ray</dc:creator>
		<pubDate>Fri, 27 Mar 2009 01:35:38 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-767</guid>
		<description>hi,

i have the drag and drop sorting working but its not saving the order.

in firebug this is what is coming up in the post

widgets[] 2
widgets[] 3

for some reason the ID is coming up empty.. can someone help me?

i have checked the code many times....no idea what the problem could be...</description>
		<content:encoded><![CDATA[<p>hi,</p>
<p>i have the drag and drop sorting working but its not saving the order.</p>
<p>in firebug this is what is coming up in the post</p>
<p>widgets[] 2<br />
widgets[] 3</p>
<p>for some reason the ID is coming up empty.. can someone help me?</p>
<p>i have checked the code many times&#8230;.no idea what the problem could be&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomas Kupka</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-760</link>
		<dc:creator>Tomas Kupka</dc:creator>
		<pubDate>Tue, 10 Mar 2009 17:16:25 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-760</guid>
		<description>Thanks, it works great!! with cake 1.2</description>
		<content:encoded><![CDATA[<p>Thanks, it works great!! with cake 1.2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-751</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Fri, 06 Feb 2009 18:08:38 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-751</guid>
		<description>I couldn&#039;t get this to work at first; I got a &quot;Sortable not defined&quot; javascript error, because as is, this code causes the script tags for scriptaculous and prototype to appear AFTER the document head.

I got it to work by simply adding &quot;,false&quot; at the end of the $javascript-&gt;link statements, like this;

if (isset($javascript)) {
echo $javascript-&gt;link(’scriptaculous/lib/prototype.js’, false);
echo $javascript-&gt;link(’scriptaculous/src/scriptaculous.js’, false);
}


works fine now.

Cheers!

Loren</description>
		<content:encoded><![CDATA[<p>I couldn&#8217;t get this to work at first; I got a &#8220;Sortable not defined&#8221; javascript error, because as is, this code causes the script tags for scriptaculous and prototype to appear AFTER the document head.</p>
<p>I got it to work by simply adding &#8220;,false&#8221; at the end of the $javascript-&gt;link statements, like this;</p>
<p>if (isset($javascript)) {<br />
echo $javascript-&gt;link(’scriptaculous/lib/prototype.js’, false);<br />
echo $javascript-&gt;link(’scriptaculous/src/scriptaculous.js’, false);<br />
}</p>
<p>works fine now.</p>
<p>Cheers!</p>
<p>Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastien Galarneau</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-717</link>
		<dc:creator>Sebastien Galarneau</dc:creator>
		<pubDate>Wed, 05 Nov 2008 20:00:45 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-717</guid>
		<description>Wow very nice code...
But i wanted the order to be the same when i came back on the page... ??!

thks a lot</description>
		<content:encoded><![CDATA[<p>Wow very nice code&#8230;<br />
But i wanted the order to be the same when i came back on the page&#8230; ??!</p>
<p>thks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dustin Weber</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-618</link>
		<dc:creator>Dustin Weber</dc:creator>
		<pubDate>Fri, 08 Aug 2008 16:16:08 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-618</guid>
		<description>Yeah, now that I looked at the code; it actually seems like there isn&#039;t anything deprecated in there after all.  Isn&#039;t that nice?!</description>
		<content:encoded><![CDATA[<p>Yeah, now that I looked at the code; it actually seems like there isn&#8217;t anything deprecated in there after all.  Isn&#8217;t that nice?!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brooks</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-616</link>
		<dc:creator>brooks</dc:creator>
		<pubDate>Fri, 08 Aug 2008 13:00:42 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-616</guid>
		<description>Excellent.  Dustin, I&#039;m using 1.2 and it seems you&#039;ve either updated the code or something, but it works great.

Thanks for helping the new guy (me)!</description>
		<content:encoded><![CDATA[<p>Excellent.  Dustin, I&#8217;m using 1.2 and it seems you&#8217;ve either updated the code or something, but it works great.</p>
<p>Thanks for helping the new guy (me)!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dustin Weber</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-606</link>
		<dc:creator>Dustin Weber</dc:creator>
		<pubDate>Thu, 07 Aug 2008 20:46:24 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-606</guid>
		<description>EVERYONE

This post is very old and probably unusable at this point.  CakePHP has changed immensely since I wrote this.  I would recommend you learn version 1.2 at this point (it is in RC2) and you&#039;ll have a much easier go of it!

Thanks,

Dustin Weber</description>
		<content:encoded><![CDATA[<p>EVERYONE</p>
<p>This post is very old and probably unusable at this point.  CakePHP has changed immensely since I wrote this.  I would recommend you learn version 1.2 at this point (it is in RC2) and you&#8217;ll have a much easier go of it!</p>
<p>Thanks,</p>
<p>Dustin Weber</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-602</link>
		<dc:creator>Karl</dc:creator>
		<pubDate>Wed, 06 Aug 2008 13:39:18 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-602</guid>
		<description>Nice tutorial, thanks.

I was scratching my head for a bit because I copied some elements of your code which then didn&#039;t work - for anyone having the same issue it is because the single and double quotes were not rendering as &#039;normal&#039; quotes inside my editor and so the strings were breaking. This is on FF3/Mac, don&#039;t know if the same is true of other browsers/OSs</description>
		<content:encoded><![CDATA[<p>Nice tutorial, thanks.</p>
<p>I was scratching my head for a bit because I copied some elements of your code which then didn&#8217;t work &#8211; for anyone having the same issue it is because the single and double quotes were not rendering as &#8216;normal&#8217; quotes inside my editor and so the strings were breaking. This is on FF3/Mac, don&#8217;t know if the same is true of other browsers/OSs</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Perkster</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-593</link>
		<dc:creator>Perkster</dc:creator>
		<pubDate>Tue, 15 Jul 2008 06:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-593</guid>
		<description>You rock!  Thanks for a great easy to learn article.</description>
		<content:encoded><![CDATA[<p>You rock!  Thanks for a great easy to learn article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yogeshs</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-578</link>
		<dc:creator>Yogeshs</dc:creator>
		<pubDate>Mon, 02 Jun 2008 15:28:32 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-578</guid>
		<description>Its nice tutorial and working fine for me.
As I m knew to cakephp so I would like to know if I have to show data in Field 1Field 2Field 3
How do apply this drag n drop sorting here above.
Please reply asap ..I need it urgently :( 
Thanks in advance ..</description>
		<content:encoded><![CDATA[<p>Its nice tutorial and working fine for me.<br />
As I m knew to cakephp so I would like to know if I have to show data in Field 1Field 2Field 3<br />
How do apply this drag n drop sorting here above.<br />
Please reply asap ..I need it urgently <img src='http://www.dustinweber.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
Thanks in advance ..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-573</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Sat, 24 May 2008 00:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-573</guid>
		<description>Thanks a lot!! I&#039;m a rookie in CakePHP, downloaded it first time yesterday. Yet I managed to follow your helpful tutorial and make it work :-)

I just had one problem; WP tweaks the output of single and double quotes, so I had to debug some PHP errors before I got it up. Lazy me didn&#039;t read the code thoroughly enough before paste - save - load page... :-)</description>
		<content:encoded><![CDATA[<p>Thanks a lot!! I&#8217;m a rookie in CakePHP, downloaded it first time yesterday. Yet I managed to follow your helpful tutorial and make it work <img src='http://www.dustinweber.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I just had one problem; WP tweaks the output of single and double quotes, so I had to debug some PHP errors before I got it up. Lazy me didn&#8217;t read the code thoroughly enough before paste &#8211; save &#8211; load page&#8230; <img src='http://www.dustinweber.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Troy</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-569</link>
		<dc:creator>Troy</dc:creator>
		<pubDate>Sun, 11 May 2008 15:10:28 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-569</guid>
		<description>Great tutorial!  I managed to get it working.  Now I&#039;m trying to add more functionality.   I wanted to have another list that I could drag from to add elements to the sortable list.  I would like this &#039;from&#039; list to stay static (I don&#039;t want elements removed from the list when they are accepted by the sortable).

I&#039;m close.  I just created a new list of $ajax-drag() elements with &#039;revert&#039;=&gt;true to create the &quot;from&quot; list.  I also added &#039;containment&#039;=&gt;&quot;[&#039;sortable_list&#039;,&#039;from_list&#039;]&quot; to the original sortable.

I can&#039;t figure out how to keep the &quot;from_list&quot; static.  It reverts if the element isn&#039;t dragged into the &quot;sortable_list&quot;.

Seems like this should be a common functionality.  I think of a shopping cart.  I wouldn&#039;t want my catalog entries disappearing when someone drops them into their cart.

Any suggestions?

Thanks,
      Troy</description>
		<content:encoded><![CDATA[<p>Great tutorial!  I managed to get it working.  Now I&#8217;m trying to add more functionality.   I wanted to have another list that I could drag from to add elements to the sortable list.  I would like this &#8216;from&#8217; list to stay static (I don&#8217;t want elements removed from the list when they are accepted by the sortable).</p>
<p>I&#8217;m close.  I just created a new list of $ajax-drag() elements with &#8216;revert&#8217;=&gt;true to create the &#8220;from&#8221; list.  I also added &#8216;containment&#8217;=&gt;&#8221;['sortable_list','from_list']&#8221; to the original sortable.</p>
<p>I can&#8217;t figure out how to keep the &#8220;from_list&#8221; static.  It reverts if the element isn&#8217;t dragged into the &#8220;sortable_list&#8221;.</p>
<p>Seems like this should be a common functionality.  I think of a shopping cart.  I wouldn&#8217;t want my catalog entries disappearing when someone drops them into their cart.</p>
<p>Any suggestions?</p>
<p>Thanks,<br />
      Troy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy</title>
		<link>http://www.dustinweber.com/main-page/cakephp-sortable-ajax-drag-drops-the-basics/comment-page-1/#comment-511</link>
		<dc:creator>Jeremy</dc:creator>
		<pubDate>Mon, 12 Nov 2007 14:13:50 +0000</pubDate>
		<guid isPermaLink="false">http://dustinweber.com/?p=1263#comment-511</guid>
		<description>@Dustin Thank you for the great tutorial!

@MRashed The sortable id is referring to the unordered list (ul) id of widgets. The widget_{id} is the id for each of the list items (li).

@Mike &amp; Ryan You are able to style the list based on your needs, but here is a little something to help in your css:
ul#widgets{list-style-type:none;}
ul#widgets li{border:1px solid #000; cursor:move;}

@James I am not sure but I think the problem is that you are trying to render in your order function. Also you don&#039;t need all that because in the index function you set your success message, and in your view the status is hidden then when the order function is complete the status is shown.</description>
		<content:encoded><![CDATA[<p>@Dustin Thank you for the great tutorial!</p>
<p>@MRashed The sortable id is referring to the unordered list (ul) id of widgets. The widget_{id} is the id for each of the list items (li).</p>
<p>@Mike &amp; Ryan You are able to style the list based on your needs, but here is a little something to help in your css:<br />
ul#widgets{list-style-type:none;}<br />
ul#widgets li{border:1px solid #000; cursor:move;}</p>
<p>@James I am not sure but I think the problem is that you are trying to render in your order function. Also you don&#8217;t need all that because in the index function you set your success message, and in your view the status is hidden then when the order function is complete the status is shown.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
