I have a list structured like below:
<ul class='binder'>
<li value='7'>Welcome
<ul class='section'>
<li value='7'>Introduction
<ul class='subsection'>
<li value='4'>About Us
<ul class='node'>
<li value='11'>2</span>
<ul class='element'>
<li value = '8' class='paragraph'>Test Paragraph</li></ul>
<li value='10' id='node_10'>1
<ul class='element'>
<li value = '7' class='ulist'>Introduction</li></ul>
</li></ul>
</li></ul>
</li></ul>
<li value='8'>Health and Safety
<ul class='section'>
<li value='8'>Just a Test
<ul class='subsection'>
<li value='5'><aaaa
</li></ul>
<li value='9'>Just a test 2
</li></ul>
</li></ul>
The layout needs to be so that each list starts with a binder, with a section, containing a subsection, then a node. Each node can then contain as many elements as the user wants.
I need to be able to move sections around, ie move to another binder with jQuery.sortable. This should also move all contained info (subsections, nodes and elements) . This needs to work all the way down the hierarchy, ie being able to move nodes around within subsections. However, nodes can only be within subsections, at the moment I am able to drag nodes into sections, and elements into binders/sections etc and this should not be possible. my jQuery is below:
$('.binder').sortable({
placeholder: 'ui-state-highlight',
revert: true,
items: 'ul.section'
});
$('.section').sortable({ placeholder: 'ui-state-highlight', revert: true, connectWith: 'ul.binder li', containment: 'ul.binder li', items: 'ul.subsection' });
$('.subsection').sortable({ placeholder: 'ui-state-highlight', revert: true, connectWith: 'ul.section li', containment: 'ul.section li', items: 'ul.node' });
Final problem is I seem to be able to move a subsection and all its contents to another binder, but then I cannot move it back into that binder?
Any ideas?
Thanks in advance.