Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Drag n Drop - Save with Cookie (Scriptaculous) (http://www.go4expert.com/forums/drag-n-drop-save-cookie-scriptaculous-t3483/)

passatgt 20Mar2007 02:13

Drag n Drop - Save with Cookie (Scriptaculous)
 
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 20Mar2007 10:04

Re: Drag n Drop - Save with Cookie (Scriptaculous)
 
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.


All times are GMT +5.5. The time now is 13:43.