You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/reorder-group.md
+49-5Lines changed: 49 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,27 +16,71 @@ import Slots from '@ionic-internal/component-api/v8/reorder-group/slots.md';
16
16
import EncapsulationPill from '@components/page/api/EncapsulationPill';
17
17
18
18
19
-
The reorder group is a container for items using the [reorder](./reorder) component. When the user drags an item and drops it in a new position, the `ionItemReorder` event is dispatched. A handler for this event should be implemented that calls the `complete` method.
19
+
The reorder group is a container for items using the [reorder](./reorder) component. When the user drags an item and drops it, the `ionReorderEnd` event is dispatched. A handler for this event should be implemented that calls the `complete` method.
20
20
21
-
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. For example usage of the reorder group, see the [reorder](./reorder) documentation.
21
+
The `detail` property of the `ionReorderEnd` 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`an index. For example usage of the reorder group, see the [reorder](./reorder) documentation.
22
22
23
23
24
24
## Interfaces
25
25
26
-
### ItemReorderEventDetail
26
+
### ReorderMoveEventDetail
27
27
28
28
```typescript
29
-
interfaceItemReorderEventDetail {
29
+
interfaceReorderMoveEventDetail {
30
+
from:number;
31
+
to:number;
32
+
}
33
+
```
34
+
35
+
### ReorderEndEventDetail
36
+
37
+
```typescript
38
+
interfaceReorderEndEventDetail {
30
39
from:number;
31
40
to:number;
32
41
complete: (data?:boolean|any[]) =>any;
33
42
}
34
43
```
35
44
36
-
### ItemReorderCustomEvent
45
+
### ReorderMoveCustomEvent
46
+
47
+
While not required, this interface can be used in place of the `CustomEvent` interface for stronger typing with Ionic events emitted from this component.
While not required, this interface can be used in place of the `CustomEvent` interface for stronger typing with Ionic events emitted from this component.
Copy file name to clipboardExpand all lines: docs/api/reorder.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ import EncapsulationPill from '@components/page/api/EncapsulationPill';
20
20
21
21
Reorder is a component that allows an item to be dragged to change its order within a group of items. It must be used within a [reorder group](./reorder-group) to provide a visual drag and drop interface.
22
22
23
-
The reorder is the anchor used to drag and drop the items. Once the reorder is complete, the `ionItemReorder` event will be dispatched from the reorder group and the `complete` method needs to be called.
23
+
The reorder is the anchor used to drag and drop the items. Once the reorder is complete, the `ionReorderEnd` event will be dispatched from the reorder group and the `complete` method needs to be called.
24
24
25
25
26
26
## Basic Usage
@@ -73,6 +73,29 @@ import UpdatingData from '@site/static/usage/v8/reorder/updating-data/index.md';
73
73
74
74
<UpdatingData />
75
75
76
+
## Event Handling
77
+
78
+
### Using `ionReorderStart` and `ionReorderEnd`
79
+
80
+
The `ionReorderStart` event is emitted when the user begins a reorder gesture. This event fires when the user taps and holds an item, before any movement occurs. This is useful for preparing the UI for the reorder operation, such as hiding certain elements or updating the visual state of items. For example, icons in list items can be hidden while they are being dragged and shown again when the reorder is complete.
81
+
82
+
The `ionReorderEnd` event is emitted when the user completes the reorder gesture. This occurs when the user releases the item they are dragging, for example by lifting their finger on a touch screen or releasing the mouse button. The event includes the `from` and `to` indices of the item, as well as the `complete` method that should be called to finalize the reorder operation. The `from` index will always be the position of the item when the gesture started, while the `to` index will be its final position. This event will fire even if no items have changed position, in which case the `from` and `to` indices will be the same.
83
+
84
+
import ReorderStartEndEvents from '@site/static/usage/v8/reorder/reorder-start-end-events/index.md';
85
+
86
+
<ReorderStartEndEvents />
87
+
88
+
### Using `ionReorderMove`
89
+
90
+
The `ionReorderMove` event is emitted continuously during the reorder gesture as the user drags an item. The event includes the `from` and `to` indices of the item. Unlike `ionReorderEnd`, the `from` index in this event represents the last known position of the item (which updates as the item moves), while the `to` index represents its current position. If the item has not changed position since the last event, the `from` and `to` indices will be the same. This event is useful for tracking position changes during the drag operation. For example, the ranking or numbering of items can be updated in real-time as they are being dragged to maintain a logical ascending order.
91
+
92
+
:::warning
93
+
Do not call the `complete` method during the `ionReorderMove` event as it can break the gesture.
94
+
:::
95
+
96
+
import ReorderMoveEvent from '@site/static/usage/v8/reorder/reorder-move-event/index.md';
0 commit comments