1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Drag n Drop - Save with Cookie (Scriptaculous)

Discussion in 'PHP' started by passatgt, Mar 19, 2007.

  1. passatgt

    passatgt New Member

    Joined:
    Mar 19, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    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.
     

Share This Page