mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(reorder): improve docs on how to use complete method (#25086)
This commit is contained in:
@@ -6,6 +6,16 @@ Once the user drags an item and drops it in a new position, the `ionItemReorder`
|
||||
|
||||
The `detail` property of the `ionItemReorder` event includes all of the relevant information about the reorder operation, including the `from` and `to` indexes. In the context of reordering, an item moves `from` an index `to` a new index.
|
||||
|
||||
## Completing a Reorder
|
||||
|
||||
When the `ionItemReorder` event is dispatched, developers have the option to call the `complete()` method on `ion-reorder-group`. This will complete the reorder operation.
|
||||
|
||||
By default, the `complete()` method will re-order the DOM nodes inside of `ion-reorder-group`.
|
||||
|
||||
For developers who need to sort an array based on the order of the items in `ion-reorder-group`, we recommend passing the array as a parameter in `complete()`. Ionic will sort and return the array so that it can be reassigned.
|
||||
|
||||
In some cases, it may be necessary for an app to re-order both the array and the DOM nodes on its own. When this happens, it is recommended to pass `false` to the `complete()` method. This will prevent Ionic from re-ordering any DOM nodes inside of `ion-reorder-group`.
|
||||
|
||||
## Interfaces
|
||||
|
||||
### ItemReorderEventDetail
|
||||
|
||||
Reference in New Issue
Block a user