Having an odd problem with sortable_element. The :url option doesn;t
seem to actually work. No AJAX calls are being generated. I can tell
because Firebug extension does not show any AJAX requests, and the
development.log file does not do anything when droppping the items in
new positions.
Here is the code I am using for sortable generation:
<%= sortable_element ''images'',
:url => {
:action => ''reorder_images'',
:id => @product
},
:overlap => :horizontal,
:constraint => false,
:tag => :div
%>
Which generates the following javascript:
<script type="text/javascript">
//<![CDATA[
Sortable.create("images", {constraint:false, onUpdate:function(){new
Ajax.Request(''/admin/products/reorder_images/1'',
{asynchronous:true,
evalScripts:true, parameters:Sortable.serialize("images")})},
overlap:''horizontal'', tag:''div''})
//]]>
</script>
the onUpdate portion of the sortable looks correct, but no AJAX
requested is created. The sortable_elements pieces are draggable and
dropppable, and I can reorder any way I please, but with no way to save
it''s kind of moot.
Has anyone else managed to get this working? Am I missing something
stupid? Is this a bug in prototype/scriptaculous?
--
Posted via http://www.ruby-forum.com/.
Alex Wayne
2006-May-31 00:18 UTC
[Rails] Re: sortable_element does not initiate AJAX calls
Alex Wayne wrote:> Having an odd problem with sortable_element. The :url option doesn;t > seem to actually work. No AJAX calls are being generated. I can tell > because Firebug extension does not show any AJAX requests, and the > development.log file does not do anything when droppping the items in > new positions.found the solution here: http://www.ruby-forum.com/topic/66894 Apparently, the sortable elements must have an id in the proper format or Sortable.serialize just silently fails aborting the AJAX call. The proper id format is: <div id="sortablecontainer"> <div id="item_1">a</div> <div id="item_2">b</div> <div> There should really be a javascript error thrown if Sortable.serailze fails. -- Posted via http://www.ruby-forum.com/.