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

One DataSource for multiple components

1 Answer 199 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Sebastian
Top achievements
Rank 1
Sebastian asked on 10 Sep 2015, 07:34 AM

Hello,

I want to use one DataSource for different components like pie charts, bar charts and grids. So, if I set a filter on my UI all displayed widgets would refresh.

Example DataSource:

var dataSource = new kendo.data.DataSource({
  data: [
    {project: "Project A", budget: 700, task: "Task A"},
    {project: "Project A", ​budget: 50, task: "Task ​B"},
    {project: "Project ​B", ​budget: 250, task: "Task ​C"}
  ]
});

A pie char​t ​may display the total budget for each project. The chart would show the following data: Project A - 75%; Project B - 25%.

A bar chart may display the budget for each task. The data would be: Task A - 700, Task B - 50, Task C - 250.

And a grid may display the ​raw data without grouping ect.

My problem is that the DataSource seems not to fit this requirement, because a grouping and aggregation for the pie chart seems not to be possible. Is the DataSource designed to be shared among different modules? I want to avoid coding grouping, aggregation and filtering on my own, because the widget I am developing must provide much more components than pie chart, bar chart and grid with different filters and grouping the end user should attach/detach.

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 11 Sep 2015, 02:46 PM

Hello Sebastian,

 

Indeed, it is possible to bind multiple widgets to a single DataSource instance. However, the DataSource component does not support multiple views. This means that once a grouping or sorting, or filtering are applied, the data will be shaped the same way for all of the bound widgets. It is not possible to configure separate operations for individual widgets. If this is necessary a separate, per widget DataSource instances will be  needed.

 

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
Sebastian
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or