One DataSource for multiple components

2 posts, 0 answers
  1. Sebastian
    Sebastian avatar
    17 posts
    Member since:
    Mar 2015

    Posted 10 Sep 2015 Link to this post


    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{
      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.

  2. Rosen
    Rosen avatar
    3247 posts

    Posted 11 Sep 2015 Link to this post

    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.


    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top