I've got a problem with Mootools Fx.Sort.
<ul id="list">
<li>One</li>
<li>Two</li>
</ul>
Javascript:
mySort = new Fx.Sort($$('ul#list>li'));
I can add more elements to the list:
$('list').adopt(new Element('li', { text: 'Three' }));
But the run-time created list elements, obviously, are not considered by Fx.Sort instance and they cannot be sorted with the others.
Is there a way to add them to the existing Fx.Sort? Or the only thing is to replace mySort
with a new instance every time I add an element at run-time?
right - it's trickier to keep it compatible with implementations of the Fx.Sort and keep it sorting as it should etc, here's a working example whereby any of the items being clicked goes to the top and then expands:
http://jsfiddle.net/dimitar/FcN32/
specific to you:
this is being called like
instance.adopt(someel, <optional pos>)
where pos is a numeric position in the list. if omitted, it will append to tail. hope it helps...