Sortables on nested lists break #1162

Closed
Speedrockracer opened this Issue Nov 13, 2012 · 1 comment

Comments

Projects
None yet
2 participants

Heya,

I use the sortables plugin for a project to order a menu.
The list is build something like this:
`

  • menu item1
  • menu item2
    • submenuitem1
    • submenuitem2
  • menu item3
    • submenuitem1
    • submenuitem2

`
The plugin wont allow me to drag a menu item from a nested list to the main list or to a other sub list. I if add all the sublists with the addLists() function.
I made a quick fix in the addItems() function of the sortables class.

addItems: function(){
        Array.flatten(arguments).each(function(element){
            this.elements.push(element);
            var start = element.retrieve('sortables:start', function(event){
                                if(event.target.getParent('li') == element) // mod to allow nested lists
                                    this.start.call(this, event, element);
            }.bind(this));

            (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
        }, this);
        return this;
    },

This stops the click event if it is in a submenu so the right menu item is dragged. However I still have the issue of moving from one sublist to the other. First time posting a bug so I hope I did it right.

Greetingz
Speedrock

Owner

arian commented Nov 13, 2012

Sortables isn't designed to work with nested lists...

@arian arian closed this Nov 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment