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

Slow grid page change due to data source reload

1 Answer 244 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mat
Top achievements
Rank 1
Mat asked on 11 Mar 2015, 11:56 AM
Hi all,

I'm having a trouble with a RadGrid and a DataSource.

I'm populating my datasource within the radGrid_NeedDataSource event. I'm using paging and filtering on my grid. I wanted to translate the content of a single column of my grid and I added some code within the NeedDataSource Event, like this (very summarized) :

// Getting the data from a custom CACHE
l_resource = CacheManager.Instance.GetResource(....);

// Translation process and assign dataSource to Grid.
myGrid.DataSource = TranslateDataSource(l_resource);

Due to huge amount of data, and a translation process being a bit slow, I realized that, when changing page, the grid calls again the NeedDataSource event and therefore, get the data and perform the translation process all over again. The problem is that, my query returns more than 100'000 elements and I display only 20 of them on the grid due to paging.

Now, here is what bugs me :

I either should download all the datas ONCE then give them to the data grid and never ask for a new datasource again when passing to a new page of my grid.
This process would give me a slow first load of the page then changing my grid's pages would be very quick...

...Or whenever I want another grid's page to display, I should send the specific informations so my query result is as small as possible. For example 20 items if my paging is 20 items, instead of 100000 items to display 20 items. It would therefore be optimized to display the correct amount of data within my grid.

I'm a bit surprized of this behavior and I would like to know what would be the best way to deal with that kind of problem.

Can you guys help me please ?

Stéphane
    

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 13 Mar 2015, 03:08 PM
Hello Stéphane,

In order optimize performance you can use custom paging. This way only the necessary records will be retrieved from the data source when changing pages in RadGrid. Check out the following online demo that illustrates the approach.



Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Mat
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or