From 3f3a2bcfcef93d7f7bdbda0522a21a3a9cd76459 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Fri, 8 Apr 2022 13:06:02 -0400 Subject: [PATCH] docs(reorder): improve docs on how to use complete method (#25086) --- core/src/components/reorder-group/readme.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/components/reorder-group/readme.md b/core/src/components/reorder-group/readme.md index 1708ac59410..081120d642b 100644 --- a/core/src/components/reorder-group/readme.md +++ b/core/src/components/reorder-group/readme.md @@ -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