React Sortable API
Sortable is a user interface utility that allows a UI component's items to be reordered via drag and drop gestures.
Props
This section describes properties that configure Sortable UI component content, behavior, and appearance.
Name | Description |
---|---|
allowDropInsideItem |
Allows a user to drop an item inside another item. |
allowReordering |
Allows a user to reorder sortable items. |
autoScroll |
Enables automatic scrolling while dragging an item beyond the viewport. |
boundary |
Specifies a DOM element that limits the dragging area. |
container |
Specifies a custom container in which the draggable item should be rendered. |
cursorOffset |
Specifies the cursor offset from the dragged item. |
data |
A container for custom data. |
dragComponent |
An alias for the dragTemplate property specified in React. Accepts a custom component. Refer to Using a Custom Component for more information. |
dragDirection |
Specifies the directions in which an item can be dragged. |
dragRender |
An alias for the dragTemplate property specified in React. Accepts a rendering function. Refer to Using a Rendering Function for more information. |
dragTemplate |
Specifies custom markup to be shown instead of the item being dragged. |
dropFeedbackMode |
Specifies how to highlight the item's drop position. |
elementAttr |
Specifies the global attributes to be attached to the UI component's container element. |
filter |
Specifies a CSS selector for the items that can be dragged. |
group |
Allows you to group several UI components, so that users can drag and drop items between them. |
handle |
Specifies a CSS selector (ID or class) that should act as the drag handle(s) for the item(s). |
height |
Specifies the UI component's height. |
itemOrientation |
Notifies the UI component of the items' orientation. |
moveItemOnDrop |
Moves an element in the HTML markup when it is dropped. |
onAdd |
A function that is called when a new item is added. |
onDisposing |
A function that is executed before the UI component is disposed of. |
onDragChange |
A function that is called when the dragged item's position in the list is changed. |
onDragEnd |
A function that is called when the drag gesture is finished. |
onDragMove |
A function that is called every time a draggable item is moved. |
onDragStart |
A function that is called when drag gesture is initialized. |
onInitialized |
A function used in JavaScript frameworks to save the UI component instance. |
onOptionChanged |
A function that is executed after a UI component property is changed. |
onRemove |
A function that is called when a draggable item is removed. |
onReorder |
A function that is called when the draggable items are reordered. |
rtlEnabled |
Switches the UI component to a right-to-left representation. |
scrollSensitivity |
Specifies the distance in pixels from the edge of viewport at which scrolling should start. Applies only if autoScroll is true. |
scrollSpeed |
Specifies the scrolling speed when dragging an item beyond the viewport. Applies only if autoScroll is true. |
width |
Specifies the UI component's width. |
See Also
- Configure a Widget: Angular | Vue | React | jQuery | AngularJS | Knockout | ASP.NET MVC 5 | ASP.NET Core
Methods
Name | Description |
---|---|
beginUpdate() |
Prevents the UI component from refreshing until the endUpdate() method is called. |
defaultOptions(rule) |
Specifies the device-dependent default configuration properties for this component. |
dispose() |
Disposes of all the resources allocated to the Sortable instance. |
element() |
Gets the root UI component element. |
endUpdate() |
Refreshes the UI component after a call of the beginUpdate() method. |
getInstance(element) |
Gets the instance of a UI component found using its DOM node. |
instance() |
Gets the UI component's instance. Use it to access other methods of the UI component. |
off(eventName) |
Detaches all event handlers from a single event. |
off(eventName, eventHandler) |
Detaches a particular event handler from a single event. |
on(eventName, eventHandler) |
Subscribes to an event. |
on(events) |
Subscribes to events. |
option() |
Gets all UI component properties. |
option(optionName) |
Gets the value of a single property. |
option(optionName, optionValue) |
Updates the value of a single property. |
option(options) |
Updates the values of several properties. |
resetOption(optionName) |
Resets an property to its default value. |
See Also
- Call Methods: Angular | Vue | React | jQuery | AngularJS | Knockout | ASP.NET MVC 5 | ASP.NET Core
Events
Name | Description |
---|---|
add |
Raised when a new item is added. |
disposing |
Raised before the UI component is disposed of. |
dragChange |
Raised when the dragged item's position in the list is changed. |
dragEnd |
Raised when drag gesture is finished. |
dragMove |
Raised every time a draggable item is moved. |
dragStart |
Raised when drag gesture is initialized. |
initialized |
Raised only once, after the UI component is initialized. |
optionChanged |
Raised after a UI component property is changed. |
remove |
Raised when a draggable item is removed. |
reorder |
Raised when the draggable items are reordered. |
See Also
- Handle Events: Angular | Vue | React | jQuery | AngularJS | Knockout | ASP.NET MVC 5 | ASP.NET Core
If you have technical questions, please create a support ticket in the DevExpress Support Center.