setDataSource

Sets the data source of the widget.

Parameters

dataSource kendo.data.PivotDataSourceV2

The data source to which the widget should be bound.

Example - set the data source

<div id="pivotgrid"></div>
<script>
    $("#pivotgrid").kendoPivotGridV2({
        height: 550,
        dataSource: {
            type: "xmla",
            columns: [{ name: "[Date].[Calendar]", expand: true }, { name: "[Geography].[City]" } ],
            rows: [{ name: "[Product].[Product]" }],
            measures: ["[Measures].[Internet Sales Amount]"],
            transport: {
                connection: {
                    catalog: "Adventure Works DW 2008R2",
                    cube: "Adventure Works"
                },
                read: 'https://demos.telerik.com/olap/msmdpump.dll'
            }
        }
    });
    var dataSource = new kendo.data.PivotDataSourceV2({
        type: "xmla",
        columns: [{ name: "[Date].[Calendar]", expand: true }],
        rows: [{ name: "[Product].[Product]" }],
        measures: ["[Measures].[Internet Sales Amount]"],
        transport: {
            connection: {
                catalog: "Adventure Works DW 2008R2",
                cube: "Adventure Works"
            },
            read: 'https://demos.telerik.com/olap/msmdpump.dll'
        }
    });

    setTimeout(function(){
        var pivotgrid = $("#pivotgrid").data("kendoPivotGridV2");
        pivotgrid.setDataSource(dataSource);
    }, 2000);
</script>
In this article