user2049357
user2049357

Reputation: 321

Can I apply same data source for kendo grid and chart without using shared datasource

I have kendo grid and chart in my application.I am using shared data source for both grid and chart.But i want to use same datasource for both grid and chart without using shared datasource.I want to bind the result of grid as chart datasource.Is it possible?If it is possible how to do that?If any one know about this please help me..

Upvotes: 1

Views: 1534

Answers (1)

Petur Subev
Petur Subev

Reputation: 20213

Well if you do not want to use shared dataSource then you have to use different dataSource with the same configuration object. I guess you are trying to stay DRY.

To do so you can use the same configuration object in both places. e.g.

var configDS = {
                        type: "odata",
                        transport: {
                            read: "..."
                        },
                        schema: {
                            model: {
                                fields: {
                                    ...
                                }
                            }
                        },
                        pageSize: 20,
                        serverPaging: true,
                        serverFiltering: true,
                        serverSorting: true
                    }

$("#grid").kendoGrid({
       dataSource: configDS 
       //other options for Grid
  })
$('#chart').kendoChart({
       datasource:configDS
      //other options for Chart
})

Upvotes: 4

Related Questions