docs(reorder): improve docs on how to use complete method (#25086)

This commit is contained in:
Liam DeBeasi
2022-04-08 13:06:02 -04:00
committed by GitHub
parent cd2852fdcc
commit 3f3a2bcfce

View File

@@ -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