Pivote Grid error: Uncaught TypeError: e.aggregate is not a function

1 Answer 278 Views
PivotGrid
Gedalya
Top achievements
Rank 1
Gedalya asked on 08 Oct 2021, 09:26 PM

I am attempting to locally run in my environment the code from the following demo:

https://demos.telerik.com/kendo-ui/pivotgrid/local-flat-data-binding

If I use the code functionally as-is it works fine. If however I change to an older version I receive the following error:

Uncaught TypeError: e.aggregate is not a function

My application is using version 2014.2.1008 which does provide the Pivot Grid even as it is a very old version. Is this a known issue resolved in a later version? Or perhaps I am just doing something wrong. Below is my code:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8"/>
    <title>Pivot Grid Demo</title>
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2014.2.1008/styles/kendo.common.min.css" />
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2014.2.1008/styles/kendo.default.min.css" />
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2014.2.1008/styles/kendo.default.mobile.min.css" />
    <script src="http://kendo.cdn.telerik.com/2014.2.1008/js/jquery.min.js"></script>
    <script src="http://kendo.cdn.telerik.com/2014.2.1008/js/kendo.all.min.js"></script>
    <style>
        #configurator {
            width: 400px;
            min-width: 400px;
            display: inline-block;
            vertical-align: top;
        }

        #pivotgrid {
            width: 67%;
            display: inline-block;
            vertical-align: top;
        }
    </style>
</head>
<body>
    <script src="https://demos.telerik.com/kendo-ui/content/shared/js/products.js"></script>
	<div id="example">
	    <div class="hidden-on-narrow" id="configurator"></div>
	    <div class="hidden-on-narrow" id="pivotgrid"></div>
	
	    <div class="responsive-message"></div>
	
	    <script>
	        $(document).ready(function () {
	            var pivotgrid = $("#pivotgrid").kendoPivotGrid({
	                filterable: true,
	                sortable: true,
	                columnWidth: 120,
	                height: 570,
	                dataSource: {
	                    data: products,
	                    schema: {
	                        model: {
	                            fields: {
	                                ProductName: { type: "string" },
	                                UnitPrice: { type: "number" },
	                                UnitsInStock: { type: "number" },
	                                Discontinued: { type: "boolean" },
	                                CategoryName: { field: "Category.CategoryName" }
	                            }
	                        },
	                        cube: {
	                            dimensions: {
	                                ProductName: { caption: "All Products" },
	                                CategoryName: { caption: "All Categories" },
	                                Discontinued: { caption: "Discontinued" }
	                            },
	                            measures: {
	                                "Sum": { field: "UnitPrice", format: "{0:c}", aggregate: "sum" },
	                                "Average": { field: "UnitPrice", format: "{0:c}", aggregate: "average" }
	                            }
	                        }
	                    },
	                    columns: [{ name: "CategoryName", expand: true }, { name: "ProductName" } ],
	                    rows: [{ name: "Discontinued", expand: true }],
	                    measures: ["Sum"]
	                }
	            }).data("kendoPivotGrid");
	
	            $("#configurator").kendoPivotConfigurator({
	                dataSource: pivotgrid.dataSource,
	                filterable: true,
	                sortable:true,
	                height: 570
	            });
	        });
	    </script>
	</div>
</body>
</html>


 

1 Answer, 1 is accepted

Sort by
1
Georgi Denchev
Telerik team
answered on 13 Oct 2021, 09:04 AM

Hi, Gedalya,

Thank you for the provided details.

The configuration looks good and given that the issue is no longer present in newer versions, my conclusion would be that this was either a bug that was fixed or the aggregates had not yet been introduced in this version.

The error seems to disappear with the next release(v2014.3.1119). I would definitely advise that you update to the newest version if possible, as it'll contain the latest changes and bugfixes. 

Best Regards,
Georgi Denchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PivotGrid
Asked by
Gedalya
Top achievements
Rank 1
Answers by
Georgi Denchev
Telerik team
Share this question
or