Is it possible to get the order of the moved item

1 Answer 49 Views
TaskBoard
Mark
Top achievements
Rank 3
Iron
Iron
Iron
Mark asked on 25 Aug 2023, 08:59 AM | edited on 29 Aug 2023, 08:04 PM
When the board change event is raised, is it possible to get the order (or index) of the moved item in the event data.

I am getting this manually like this:


const handleTaskBoardChange = React.useCallback((event) => {

        if (event.type === "task") {

            setTaskData(event.data);

            // Get new order of moved item
            var allItemsAtDroppedStatus = event.data.filter(x => { return x.status === event.item.status });

            var newOrder = allItemsAtDroppedStatus.findIndex(x => { return x.id === event.item.id }) + 1;

            var data = { id: event.item.id, previousCampaignProjectStageType: event.previousItem.status, newCampaignProjectStageType: event.item.status, order: newOrder, };

            updateCampaignTaskBoardStage(data)
                .then((response) => {
                    loadTaskBoardData();
                })
                .catch((response) => {
                });
        }
    }, []);

I was just wondering if there is something built in that I have missed, if not, this would ideally be included in the event item data for the moved item in order to persist the item orders when saved, it seems like a natural property to have.

Thanks.

note: there is no TaskBoard tag to assign this to.

1 Answer, 1 is accepted

Sort by
1
Accepted
Wissam
Telerik team
answered on 29 Aug 2023, 06:39 AM

Hello, Mark,

I tested the `onChange` event of the TaskBoard which is supposed to show the previous index using `event.previousItem.id`. However, it is currently showing the current `id` in `previousItem.id`. Therefore, I logged an issue for this bug, you can track it here:

I also added the workaround you provided to the issue. Thank you so much for sending it to us.

In addition, I updated your Telerik points accordingly as a small token of gratitude for your report.

If you have any further questions on this matter, please let me know.

Regards,
Wissam
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Tags
TaskBoard
Asked by
Mark
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Wissam
Telerik team
Share this question
or