Skip to content

Commit

Permalink
docs(reorder): improve docs on how to use complete method (#25086)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamdebeasi authored Apr 8, 2022
1 parent cd2852f commit 3f3a2bc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/components/reorder-group/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3f3a2bc

Please sign in to comment.