All,

     I have three sortables on may page and I am able to move each
item from one sortable to another just fine.  I was able to write some
code that determines which element is in which sortable via a cookie.
So just after the page has loaded I run a script that tells the
sortables to setSequence to the last known arrangement from the
cookie.  It works fine when the items that are in the initial sortable
are reordered in that sortable.  However when I move an item from the
first sortable to the second and change the cookie, restore the page,
the item that was moved does not display at all.  Any idea what is
going on.

It is a 3x3 grid and each column is a sortable and each item has a
number 1-9 so the grid looks like this:

| 1 | 4 | 7 |
| 2 | 5 | 8 |
| 3 | 6 | 9 |

So if I move for instance item 1 over to the second sortable the grid
will look like this


| 2 | 1 | 7 |
| 3 | 4 | 8 |
|    | 5 | 9 |
|    | 6 |    |

Then when I go to refresh the page or leave and then come back the
grid will be look like this:

| 2 | 4 | 7 |
| 3 | 5 | 8 |
|    | 6 | 9 |

Also here is the code that I am working with:
HTML****************************************************************************************************************************
<ul id="blocks" class="block">
    <li id="block_1" style="background:none;padding:0;">{content
block='Search'}</li>
    <li id="block_2" style="background:none;padding:0;">{content
block='News'}</li>
    <li id="block_3" style="background:none;padding:0;">{content
block='Recent Updates'}</li>
</ul>


<ul id="blocks2" class="block">
   <li id="block_4" style="background:none;padding:0;">{content
block='Calendar'}</li>
   <li id="block_5" style="background:none;padding:0;">{content
block='Sales & Marketing'}</li>
   <li id="block_6" style="background:none;padding:0;">{content
block='Rumor Central'}</li>
</ul>

<ul id="blocks3" class="block">
   <li id="block_7" style="background:none;padding:0;">{content
block='Productivity'}</li>
   <li id="block_8" style="background:none;padding:0;">{content
block='Business'}</li>
   <li id="block_9" style="background:none;padding:0;">{content
block='After 5'}</li>
</ul>




{literal}
<script type="text/javascript" language="javascript">
function myDate(days){
   var date = new Date();
   date.setTime(date.getTime()+(days*24*60*60*1000));
   var expires = "; expires="+date.toGMTString();
   return expires;
}
options= {overlap:'horizontal', constraint:false, dropOnEmpty:true,
containment:['blocks', 'blocks2', 'blocks3'], onUpdate: function()
{document.cookie = "BlockOrder="+Sortable.sequence('blocks')
+myDate(365)+"; path=/";}};

Sortable.create('blocks', {overlap:'horizontal', constraint:false,
dropOnEmpty:true, containment:['blocks', 'blocks2', 'blocks3'],
onUpdate: function() {document.cookie =
"BlockOrder1="+Sortable.sequence('blocks')+myDate(365)+";
path=/";}});

Sortable.create('blocks2', {overlap:'horizontal', constraint:false,
dropOnEmpty:true, containment:['blocks', 'blocks2', 'blocks3'],
onUpdate: function() {document.cookie =
"BlockOrder2="+Sortable.sequence('blocks2')+myDate(365)+";
path=/";}});

Sortable.create('blocks3', {overlap:'horizontal', constraint:false,
dropOnEmpty:true, containment:['blocks', 'blocks2', 'blocks3'],
onUpdate: function() {document.cookie =
"BlockOrder3="+Sortable.sequence('blocks3')+myDate(365)+";
path=/";}});


arrangeBlocks();

</script>
{/literal}


***********************************************************************************************************************************
JavaScript+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++

function arrangeBlocks(){
        var block1 = new String(readCookie('BlockOrder1'));
        var block2 = new String(readCookie('BlockOrder2'));
        var block3 = new String(readCookie('BlockOrder3'));
        var block1String = new Array();
        var block2String = new Array();
        var block3String = new Array();
        var count = 0;
        var i=0;
        for (i=0;i<=block1.length;i+=2)
        {
                block1String[count] =  block1.charAt(i);
                count++;
        }
        count = 0;
        for (i=0;i<=block2.length;i+=2)
        {
                block2String[count] =  block2.charAt(i);
                count++;
        }
        count = 0;
        for (i=0;i<=block3.length;i+=2)
        {
                block3String[count] =  block3.charAt(i);
                count++;
        }
        //document.write(block1String + " :: ");
        //document.write(block2String + " :: ");
        //document.write(block3String);
        Sortable.setSequence('blocks', block1String);
        Sortable.setSequence('blocks2', block2String);
        Sortable.setSequence('blocks3', block3String);
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++

Thanks,
Fintch
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to