# Adding to a sortable\_element

**URL:** <https://www.ruby-forum.com/t/adding-to-a-sortable-element/189118>\
**Category:** Rails\
**Created:** [May 24, 2010, 9:36pm UTC](https://www.ruby-forum.com/t/adding-to-a-sortable-element/189118 "2010-05-24T21:36:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiny\_clanger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c37758/32.png) [@tiny\_clanger](https://www.ruby-forum.com/u/tiny_clanger)\
**Post date:** [May 24, 2010, 9:36pm UTC](https://www.ruby-forum.com/t/adding-to-a-sortable-element/189118/1 "2010-05-24T21:36:37Z")

</div>

Am adding to a sortable list using Ajax, and to get the Scriptaculous  
effects to kick in after the add, the only way I have found is by  
re-executing sortable\_element.

Can anyone suggest a better way of doing this, as the eval in here is  
not good.

\<%= link\_to\_remote “Add”,  
:url =\> { :controller =\> “pages”, :action =\> “add\_fragment”, :pid =\>  
pid, :index\_size =\> index\_size, :fid =\> fid },  
:complete =\> “eval(decodeURIComponent(#{sortable\_element  
‘frag\_list’, :url =\> sort\_frag\_pages\_path, :complete =\>  
visual\_effect(:highlight, ‘frag\_list’), :handle =\>  
‘handle’}).gsub(’//’,’’));” %\>

Thanks
