onReorder(event: any, data: any) {
for (var i = 0; i < this.speeddials.length; i++) {
this.speeddials.speedDialIndex = i + 1;
}
}
this is how I use it and change a column value that show the order after it is reOrdered.
ordered list change
That makes sense, but I need to know which item was selected to be changed, so I can find where it's old position in the array was versus it's new position in the array.
For example, I have an API that expects the original index and a shift value. So if I reorder index 0 to go to index 1, the shift value would be 1. If I'm using the move up one / move down one functionality this is simple, but when it gets to moving an item from the bottom of the list to the top, that gets dicey.
For example, I have an API that expects the original index and a shift value. So if I reorder index 0 to go to index 1, the shift value would be 1. If I'm using the move up one / move down one functionality this is simple, but when it gets to moving an item from the bottom of the list to the top, that gets dicey.
-
- Posts: 4
- Joined: 12 Apr 2018, 14:32
Currently, the ordered list supports selection of multiple items (if we press ctrl and select the list items, they get selected. If we don't then the list items selected are toggled) Is there a way we can disable this 'multi selection of items' altogether? Not even on pressing the meta key 'ctrl'. I need to be able to select ONE item ALWAYS. Thanks
Would you share your template(HTML file )? I want to know how u call the OnReorderMethod with those two parameters because data is not possible in that scope!!
Code: Select all
<p-orderList
[value]="categoryList"
class="font-size-lg"
[dragdrop]="true"
(onReorder)="handleReorderingItem($event)"
>
<ng-template let-item pTemplate="item">
btw in current state handleReorderingItem($event) only pass selected item data as parameter since I want to get orderIndex how can I do that?
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 13 guests