In Code

You can reorder List items in code in the following ways.

  • By index
    Pass the index to the reorderItem(itemIndex, toItemIndex) method. If the List is grouped, this method should be given two objects with the indexes of the groups and the items.

    var list = $("#listContainer").dxList("instance");
    // Places the item with index 1 after the item with index 5 
    list.reorderItem(1, 5);
    // Takes the item with index 0 from the group with index 2
    // and places it to the group with index 4 after the item with index 2 
        { group: 2, item: 0 },
        { group: 4, item: 2 }
  • By DOM node
    Pass the DOM node to the reorderItem(itemElement, toItemElement) method.

    var list = $("#listContainer").dxList("instance");
    // Finds all List items
    var itemNodes = $("#listContainer").find(".dx-list-item");
    // Makes the first item the last
    list.reorderItem(itemNodes[0], itemNodes[itemNodes.length-1]);
See Also