User Interaction
If you want to allow the user to reorder items on the List, define the itemDragging object and set the allowReordering property within it to true. This setting supplies each List item with a button that enables the user to move the item with drag and drop on mouse-equipped platforms or with touch-and-drag on touch-enabled devices.
See Also
- Configure a Widget: Angular | Vue | React | jQuery | AngularJS | Knockout | ASP.NET MVC 5 | ASP.NET Core
API
You can reorder List items from 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.By DOM node
Pass the DOM node to the reorderItem(itemElement, toItemElement) method.
See Also
- Call Methods: Angular | Vue | React | jQuery | AngularJS | Knockout | ASP.NET MVC 5 | ASP.NET Core
- List Demos
- List API Reference
Events
To execute certain commands when an item changes its position, handle the itemReordered event. If the event handling function is not going to be changed during the lifetime of the UI component, assign it to the onItemReordered property when you configure the UI component.
If you are going to change the itemReordered event handler at runtime, or if you need to attach several handlers to this event, subscribe to it using the on(eventName, eventHandler) method. This approach is more typical of jQuery.
- const itemReorderedEventHandler1 = function(e) {
- // First handler of the "itemReordered" event
- };
- const itemReorderedEventHandler2 = function(e) {
- // Second handler of the "itemReordered" event
- };
- $("#listContainer").dxList("instance")
- .on("itemReordered", itemReorderedEventHandler1)
- .on("itemReordered", itemReorderedEventHandler2);
See Also
- Handle Events: Angular | Vue | React | jQuery | AngularJS | Knockout | ASP.NET MVC 5 | ASP.NET Core
- List Demos
- List API Reference
If you have technical questions, please create a support ticket in the DevExpress Support Center.