Heh.
There is a good example of using nested Scriplaculous Sortables. With one little flaw – Scriplaculous ver 1.6.x is used, and when you try to execute the code with newer version of library – sections.each is not a function error pops up.
Here is the way to fix it – you’ll probably need it if you want to save the results
Just replace “document.getElementsByClassName(‘section’);” to “$$(‘.section’);”
Before
function getGroupOrder() { var sections = document.getElementsByClassName('section'); var alerttext = ''; sections.each(function(section) { var sectionID = section.id; var order = Sortable.serialize(sectionID); alerttext += sectionID + ': ' + Sortable.sequence(section) + '\n'; }); alert(alerttext); return false; }
After
function getGroupOrder() { var sections = $$('.section'); var alerttext = ''; sections.each(function(section) { var sectionID = section.id; var order = Sortable.serialize(sectionID); alerttext += sectionID + ': ' + Sortable.sequence(section) + '\n'; }); alert(alerttext); return false; }
Then modify it for your needs and go on )
What was that?
Quote:
As of Prototype 1.6, document.getElementsByClassName has been deprecated since native implementations return a NodeList rather than an Array.
Popularity: 31% [?]
Tags: Development, JS/Ajax


[...] Read more here: Advanced Scriplaculous Sortable Demo Fix [...]