0

I'm working with Mootools sortables (v1.4).

I've got a list of items and the sorting works great via drag/drop actions. However, I'd like to also add an "up/down" arrow to each list item so that users could also just click an item up or down one "slot" if they preferred.

I didn't see anything in the docs about a method to accomplish this. Is there a way to do this?

Thanks!

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
julio
  • 6,630
  • 15
  • 60
  • 82

1 Answers1

1

why don't you just move the list item in the DOM on click of these arrows ? It won't mess with the sortable ;)

An example piece of code could look like this :

function moveUp (liID) {
    var prev = $(liID).getPrevious();
    if(prev)
        $(liID).inject(prev,"before");
}
function moveDown (liID) {
    var next = $(liID).getNext();
    if(next)
        $(liID).inject(next,"after");
}
Romain
  • 812
  • 6
  • 8