Setting Grid Data on Client

2 Answers 72 Views
Chart Grid
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Tim asked on 22 Jul 2022, 11:01 PM

I have a page that has a pie chart and a grid. Both controls use the same data. I could create a data source for each control and have it call the service twice, but that seems inefficient. Is there a way to define the data source for the chart and handle an event when the data is returned and assign the data to the grid's data source?

Which event should be handled?

What's the command to assign the data to the grid's data source?

Thanks

2 Answers, 1 is accepted

Sort by
1
Accepted
Ivan Danchev
Telerik team
answered on 27 Jul 2022, 01:49 PM

Hello Tim,

A possible way to use the same data source in 2 components (e.g., Grid and a Chart) is to declare the DataSource separately and then pass it to the components. We demonstrate this in the Shared DataSource demo: https://demos.telerik.com/aspnet-mvc/datasource/shared-datasource 

You can check how the demo is implemented in the demo's View Source tab. In this scenario an AutoComplete and a Grid share a DataSource,  which makes possible populating both components, with a single request to the server.

Regards,
Ivan Danchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Tim
Top achievements
Rank 3
Iron
Iron
Iron
answered on 28 Jul 2022, 01:32 AM
That works great. Thanks for your help!
Tags
Chart Grid
Asked by
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Ivan Danchev
Telerik team
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Share this question
or