ok, developed my own solution:

Already when creating the elements that can be sorted within the
different sortables, I add an extra attribute that stores a reference
to the sortable the element is currently in. After a sort action the
onUpdate event fires and compares whether all the elements in the
sortable are having the reference of the sortable. If not, the alert()
fires. After that, the attribute is set to the new sortables reference
to make sure that alert() does not fire on every next sort action
because it still locates the one element that has been moved from one
sortable to another:

<UL id="sortable1">
<LI id="sortedelement_1" sortable="sortable1">
<LI id="sortedelement_2" sortable="sortable1">
</UL>

<UL id="sortable2">
<LI id="sortedelement_3" sortable="sortable2">
<LI id="sortedelement_4" sortable="sortable2">
</UL>

Sortable.create('sortable1',
{ghosting:true,dropOnEmpty:true,containment["sortable1","sortable2"],constraint:false,tag:'li',onUpdate:
function() {

var orderNodes = '';
  orderedNodes =
document.getElementById('sortable1').getElementsByTagName('li');
  for (var i=0;i < orderedNodes.length;i++) {
if (orderedNodes[i].getAttribute('sortable') != 'sortable1') {
alert('The element has been moved from one sortable to another');
var elementid = orderedNodes[i].getAttribute('id');
document.getElementById(elementid).setAttribute('sortable','sortable1');
  }
    }
}
});

Sortable.create('sortable2',
{ghosting:true,dropOnEmpty:true,containment["sortable1","sortable2"],constraint:false,tag:'li',onUpdate:
function() {

var orderNodes = '';
  orderedNodes =
document.getElementById('sortable2').getElementsByTagName('li');
  for (var i=0;i < orderedNodes.length;i++) {
if (orderedNodes[i].getAttribute('sortable') != 'sortable2') {
alert('The element has been moved from one sortable to another');
var elementid = orderedNodes[i].getAttribute('id');
document.getElementById(elementid).setAttribute('sortable','sortable2');
  }
    }
}
});

Hope this helps somebody in the future.

Best Regards,
Benedikt.

-- 
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-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to