There's a possibility to move items with the help of special methods. You may move the items to the very top/bottom of the List or move them up/down by the specified number of steps:
myList.moveUp(id)
myList.moveUp(id,step);
myList.moveDown(id)
myList.moveDown(id,step)
myList.moveTop(id)
myList.moveBottom(id)
Related sample: Moving items within List
Items can also be moved to the specified position or to a different list by using the method move:
// move to the position
myList.move(id, index);
// move to a different view
myList.move(id, index, some_other_view);
// or
myList.move(id, null, some_other_view);
// move to different list and change the ID
// scenario may be needed to prevent the ID collision
myList.move(id, index, some_other_view, target_id);
ID of the item is preserved while moving.
Related sample: Moving items between Lists
It's also possible to copy an item to the defined position. For this purpose the method copy is used:
//make a copy of an element
var new_id = myList.copy(source_id);
//make a copy at the specific position
var new_id = myList.copy(source_id, index);
//make a copy in a different list
var new_id = myList.copy(source_id, index, some_other_list);
//or
var new_id = myList.copy(source_id, null , some_other_list);
//make a copy with the defined ID
myList.copy(source_id, null, null, target_id);
//or
myList.copy(source_id, index, null, target_id);
//or
myList.copy(source_id, index, some_other_list, target_id);
The method returns the ID of the copied item which is autogenerated or can be specified as the last parameter.
Back to top