From this question, i know how to move an item up:
moveUp: function(category) {
var i = categories.indexOf(category);
if (i >= 1) {
var array = categories();
categories.splice(i-1, 2, array[i], array[i-1]);
}
}
What is the equivalent for moving the item down?
In this solution, i delete two items, from index
position, and then again insert them (first - the next item, and the second - moving item):
moveDown = function(number) {
var i = self.numbers().indexOf(number);
if (i < self.numbers().length - 1) {
var rawNumbers = self.numbers();
self.numbers.splice(i, 2, rawNumbers[i + 1], rawNumbers[i]);
}
}
Demo