This is a migrated thread and some comments may be shown as answers.

dataItem.set() slow performance

2 Answers 302 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Callam
Top achievements
Rank 1
Veteran
Callam asked on 20 Aug 2020, 02:25 PM

Hi. I'm using a kendo grid backed by a datasource to display some information. The configuration for one field in this datasource can be saved to a database and reloaded (the field is called 'isActive'). I am doing this by fetching the values from a database, looping over them, getting the corresponding dataItem from the dataSource and setting it like so:

//pseudocode

for each (f in filters) {

    if (!f.isActive){

         dataItem.set("isActive", false);

    }

}

The issue is that the time it takes to set a dataItem is between 3 and 5 seconds and I will sometimes be doing this for 100s of items, so it can be very slow. In the demo for setItem it runs much faster, I'm not sure what is different. Getting the dataItem takes a fraction of a second. Is there a faster way to achieve this? I have no idea why it is taking so long

Thanks.

 

2 Answers, 1 is accepted

Sort by
0
Callam
Top achievements
Rank 1
Veteran
answered on 20 Aug 2020, 04:05 PM
Forget about this question, I was taking completely the wrong approach. Best way is to build up a new datasource from json and set it as the grid's datasource. The docs are really clear. Long day :)
0
Nikolay
Telerik team
answered on 24 Aug 2020, 10:38 AM

Hello Callam,

I am happy to hear you have managed to resolve the situation and thank you for sharing the approach you have taken. This I believe will help others facing the same scenario.

Do not hesitate to contact us back if anything new arises.

Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Data Source
Asked by
Callam
Top achievements
Rank 1
Veteran
Answers by
Callam
Top achievements
Rank 1
Veteran
Nikolay
Telerik team
Share this question
or