grid row reordering not working on newly added rows

1 Answer 241 Views
Grid
Merlin
Top achievements
Rank 1
Merlin asked on 29 Nov 2023, 01:25 AM
Grid row reordering works fine when gird first loaded. But when new rows added to the data, i cant reorder the newly added rows to another index, the rowReorder event is not firing.Im using `kendoGridInCellEditing` and `editService`.
Slavena
Telerik team
commented on 01 Dec 2023, 02:51 PM

Hi Merlin,

I tried reproducing the reported behavior, but to no avail. The rowReorder event is firing correctly when dragging newly added records:

https://stackblitz.com/edit/angular-j3eipg?file=src%2Fapp%2Fapp.component.ts 

Could you please provide us with more details regarding the exact Grid configuration. Additionally, a runnable example or an archived project that demonstrates the described discrepancy would help us further investigate and propose a suitable solution.

Thank you for your cooperation in advance. I am looking forward to your reply.

Merlin
Top achievements
Rank 1
commented on 05 Dec 2023, 08:42 AM

Hi Slavena,thanks for your detailed explaination .I found if i change

[data]="view | async"

to

[data]="editService | async"

Then the newly added records will not fire rowReorder event.

Is the extra map and process from editService to view mandatory?

Merlin
Top achievements
Rank 1
commented on 05 Dec 2023, 09:08 AM | edited

rowReorder not firing In this example. i alse modified the editService.read function, which will return an empty array in the beginning.

1 Answer, 1 is accepted

Sort by
0
Slavena
Telerik team
answered on 07 Dec 2023, 02:54 PM

Hi Merlin,

Thank you for the provided example and additional details.

Indeed, in this Grid configuration the additional EditService operations are needed in order to yield expected results:

    public read(): void {
        if (this.data.length) {
            return super.next(this.data);
        }

        this.fetch()
            .subscribe(data => {
                this.data = data;
                this.originalData = cloneData(data);
                super.next(data);
            });
    }

If the data collection is not updated, the Grid will not be notified that new records have been added, and thus will not execute the logic for determining which elements are drag and drop targets. This would lead to the newly added records not being registered as drag and drop targets and they will not fire events.

I hope this sheds some light on the matter. Let me know if further assistance is required on this case.

Regards,
Slavena
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
Grid
Asked by
Merlin
Top achievements
Rank 1
Answers by
Slavena
Telerik team
Share this question
or