How to catch row reorder event in primeng table?
Asked Answered
S

2

6


I want to trigger a reorder event after I drag and drop two rows data but I cannot see it in the document below:
https://www.primefaces.org/primeng/#/table/reorder

Can anyone help me, thanks!

Selfish answered 19/4, 2019 at 6:4 Comment(0)
B
13

As per the documentation ,

there are two callbacks available ,

onColReorder - Callback to invoke when a column is reordered

onRowReorder - Callback to invoke when a row is reordered.

They are listed under on the events portion on the same page

https://www.primefaces.org/primeng/#/table

Bumper answered 19/4, 2019 at 6:18 Comment(0)
S
3

For those wondering where to bind the onRowReorder callback to catch row reorder event.

app.component.html:

<p-table [value]="products" (onRowReorder)="onRowReorder($event)">

...

</p-table>

app.component.ts:

onRowReorder(event){
  console.log(event); //{dragIndex: 1, dropIndex: 2}
}

View in StackBlitz

Saturnian answered 1/11, 2022 at 9:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.