New to Kendo UI for jQuery? Download free 30-day trial

Expand Multiple Column Dimensions in the PivotGrid

Environment

Product Progress® Kendo UI® PivotGrid for jQuery
Operating System Windows 10 64bit
Browser Google Chrome
Browser Version 61.0.3163.100

Description

How can I reset the expanding that has occurred in the PivotGrid and revert to my CMS?

Solution

In order for the expand to properly work, set fully qualified names to the expanded tuples as shown in the following code snippet with the [Calendar Year].&[2005] configuration.

The following example demonstrates how to expand multiple column dimensions by using the dataBound event of the PivotGrid.

<div id="example">
    <div id="configurator"></div>
    <div id="pivotgrid"></div>

    <script>
        $(document).ready(function () {
            var paths = [
              //Expand CY 2010 - first dimension
              ["[Date].[Calendar].[Calendar Year].&[2010]"],
              //Expand All Products under CY 2010 - second dimension
                ["[Date].[Calendar].[Calendar Year].&[2010]","[Product].[Category].[All Products]"]
            ];

            var pivotgrid = $("#pivotgrid").kendoPivotGrid({
                filterable: true,
                sortable: true,
                columnWidth: 200,
                height: 580,
                dataSource: {
                    type: "xmla",
                    columns: [{ name: "[Date].[Calendar]", expand: true }, { name: "[Product].[Category]" } ],
                    rows: [{ name: "[Geography].[City]" }],
                    measures: ["[Measures].[Reseller Freight Cost]"],
                    transport: {
                        connection: {
                            catalog: "Adventure Works DW 2008R2",
                            cube: "Adventure Works"
                        },
                        read: "https://demos.telerik.com/olap/msmdpump.dll"
                    },
                    schema: {
                        type: "xmla"
                    },
                    error: function (e) {
                        alert("error: " + kendo.stringify(e.errors[0]));
                    }
                },
                dataBound: function() {
                  var path = paths.shift();
                  if (path) {
                    this.dataSource.expandColumn(path);
                  }
                }
            }).data("kendoPivotGrid");
        });
    </script>
</div>

See Also

In this article