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

Grid and Lazy loading

3 Answers 488 Views
Grid
This is a migrated thread and some comments may be shown as answers.
René
Top achievements
Rank 2
René asked on 20 Jun 2014, 12:10 PM
Hello,

I would like to implement some kind of lazy loading in RadGrid.

Let's say we have page with collapsed panels (via jQuery) in page. Every panel contains server generated user control - mostly grids. Current behavior is that when page loads, all grids loads data and renders everything. We need to collapse all panels and force grids to set data sources on server side (as in current state), but do NOT databind.

We want to implement calling databind() from javascript when client expands panel.

I found on web that only way how to force grid not to databind is set visible=false; But I don't think this is the best way, because control is not rendered and there is no way how to set visibility from javascript and call databind, or not?

Is there any way how to do it? Some kind of disable auto databind?

Regards
René

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 25 Jun 2014, 07:46 AM
Hello René,

You can try using the client side data binding of the RadGrid. In this case initially you can bind the grid to empty collection. Then when the panel is expanded you can fetch data from a web service and set it as datasource of the grid’s mastertableview, like is shown in the following example:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/programmatic/defaultcs.aspx
...
var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
tableView.set_dataSource(result);
tableView.dataBind();
...

Please give it try and let me know if this approach helps you.

Regards,
Radoslav
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.

 
0
René
Top achievements
Rank 2
answered on 25 Jun 2014, 08:20 AM
Hello,

yes, it should work if data are available via any service. But my data source is serverside bound inside user control. All I need is set data source and do not call databind. Then just invoke databind from client when data source is assigned.

​Regards
René
0
Radoslav
Telerik team
answered on 27 Jun 2014, 10:34 AM
Hi René,

I am sending you a simple example which demonstrates the desired functionality. Please check it out and let me know if it helps you. Looking forward for your reply.

Regards,
Radoslav
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
René
Top achievements
Rank 2
Answers by
Radoslav
Telerik team
René
Top achievements
Rank 2
Share this question
or