Drag n Drop - Save with Cookie (Scriptaculous)

passatgt's Avatar, Join Date: Mar 2007
Newbie Member
Hello.
I make a drag n drop page with scriptaculous. i'd like to save the
pozitions with cookie.
How?


The CODE:
Code:
<ul id="descmiddlebal" >
   <li>
     <div id="tvplayer">
    asd
     </div>
   </li>
   <li>
     <div class="dobozbal">
       <table>asd</table>
        </div>
   </li>
   <li>
       <div class="dobozbal">
              <div class="handle" id="dbh1">
                News
              </div>
         DESCASDEDSC
        </div>
   </li>
</ul>


<ul id="descmiddlejobb" >
   <li>
     <a href="#"><img src="images/jatek.gif" border="0" /></a>
   </li>
   <li>
       <div class="dobozjobb">
              <div class="handle" id="djh1">
                <img src="images/rss2.gif" alt="rss" border="0"
class="rss2" /> Categories
              </div>

        asdasd
        </div>
   </li>
   <li>
       <div class="dobozjobb">
              <div class="handle" id="djh2">
                <img src="images/rss2.gif" alt="rss" border="0"
class="rss2" /> Channels
              </div>
  asdasdasdasd
  </div>
   </li>
   <li>
</ul>
<script type="text/javascript">
 // <![CDATA[
   Sortable.create("descmiddlebal",
     {dropOnEmpty:true,containment:["descmiddlebal","descmiddlejobb"],constraint:false});
   Sortable.create("descmiddlejobb",
     {dropOnEmpty:true,handle:'handle',containment:["descmiddlebal","descmiddlejobb"],constraint:false});
 // ]]>
</script>

Thanks a lot
pradeep's Avatar, Join Date: Apr 2005
Team Leader
You have to write a callback function for the event onUpdate, to save the changes to a cookie, and then use Sortable.setSequence ('sortme',Sortable.sequence('sortme').sort()); to set the order next time the page loads.