Is it possible to cancel row reorder event programmatically?

Is it possible to cancel row reorder event programmatically?

JaviNottJaviNott Posts: 12Questions: 2Answers: 0

With the new version 1.3.3 of row reorder extension I have seen that some events have been added. I wonder if it's possible to cancel the event under certain conditions (i.e. target destination is not allowed due to app logic) and all the changes done being reverted.

I am currently checking if new order set by user is allowed in a function that handles the row-reorder event, but I don't know how to revert changes done.

Thanks

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin

    Hi,

    There isn't I'm afraid. By the time row-reorder tiggers, it is too late to cancel the action. This is the place that a new event would need to go.

    I'm in the middle of some other stuff at the moment, but I can look at adding that.

    Allan

  • kthorngrenkthorngren Posts: 21,449Questions: 26Answers: 4,975

    While its not exactly what you are looking for take a look at this example from this thread. Maybe it will give you some ideas until Allan can add a cancel action.

    Kevin

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Answer ✓

    I've added this ability row cancel the row reordering from the row-reorder event in this commit. It will be in the nightly shortly.

    With that you just need to add return false; to the row-reorder event handler if you want to cancel the reorder action, and the table will revert to its state from when the drag started.

    Allan

  • JaviNottJaviNott Posts: 12Questions: 2Answers: 0

    Great!

    Thanks for the support.

    Regards,

    Javi

  • JaviNottJaviNott Posts: 12Questions: 2Answers: 0

    Just a quick question, when will be released next stable version with this change included?

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin

    Its currently the only change in RowReorder since the last release, so I'll probably give it a few weeks. Or do you need it in a release urgently?

    Allan

  • JaviNottJaviNott Posts: 12Questions: 2Answers: 0

    Hi Allan,

    I have solved it by reloading the data again when that scenario happens. But as I am going to upgrade current version we are using of RowReorder for our next week release it would be great to have it, if no, it doesn't matter I will go prod with the workaround.

    I have also modified locally the clone method following instructions in this thread as I have parent and child rows I need to drag and drop together. Is there any future plan to handle child rows with RowReorder extension?

    Thank you very much for your support. I really appreaciate it.

    Javi

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Is there any future plan to handle child rows with RowReorder extension?

    Not at this time.

    I'll hopefully get the release done on Friday.

    Allan

  • JaviNottJaviNott Posts: 12Questions: 2Answers: 0

    Great Allan,

    Thank you very much indeed!

  • JaviNottJaviNott Posts: 12Questions: 2Answers: 0

    Hi Allan,

    Do you have any estimated date for the release?

    I don't want to hurry you up, it's just to plan my own release.

    Regards,

    Javier

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Hi Javier,

    Really sorry that slipped past me! That's it down now :). The NPM packages are just building.

    Allan

  • JaviNottJaviNott Posts: 12Questions: 2Answers: 0

    Thanks Allan!!

Sign In or Register to comment.