We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Cannot read property 'keys' of null

Thread ID:

Created:

Updated:

Platform:

Replies:

125659 Aug 31,2016 10:48 AM Sep 2,2016 04:45 AM JavaScript 6
loading
Tags: ejPivotGrid
RI
Asked On August 31, 2016 10:48 AM

Hello, 

i have following problem, i try to load data from DB, and build the pivot. But i get the following error:

angular.js:11655 TypeError: Cannot read property 'keys' of null
    at http://localhost:52987/Scripts/syncfusion/scripts/web/ej.web.all.js:329132:62
    at Function.grep (http://localhost:52987/Scripts/jquery.js:447:23)
    at Object._populateCalcTable (http://localhost:52987/Scripts/syncfusion/scripts/web/ej.web.all.js:329130:27)
    at Object._calculateValues (http://localhost:52987/Scripts/syncfusion/scripts/web/ej.web.all.js:328986:22)
    at Object.pivotEnginePopulate (http://localhost:52987/Scripts/syncfusion/scripts/web/ej.web.all.js:328547:18)
    at Object._populatePivotGrid (http://localhost:52987/Scripts/syncfusion/scripts/web/ej.web.all.js:329980:42)
    at Object._load (http://localhost:52987/Scripts/syncfusion/scripts/web/ej.web.all.js:329906:26)
    at Object._init (http://localhost:52987/Scripts/syncfusion/scripts/web/ej.web.all.js:329786:18)
    at Object.<anonymous> (http://localhost:52987/Scripts/syncfusion/scripts/web/ej.web.all.js:1183:18)
    at jQuery.$.fn.(anonymous function) [as ejPivotGrid] (http://localhost:52987/Scripts/syncfusion/scripts/web/ej.web.all.js:1243:25)(anonymous function) @ angular.js:11655(anonymous function) @ angular.js:8596(anonymous function) @ angular.js:16302completeOutstandingRequest @ angular.js:4924(anonymous function) @ angular.js:5312



Sastha Prathap Selvamoorthy [Syncfusion]
Replied On September 1, 2016 02:26 AM

Hi Ruzic, 
 
Sorry for the inconvenience. Due to lack of information, we are unable to provide solution for the reported problem. So, please provided us the detailed information along with your sample and scenario where the reported problem got reflected. 
 
Regards, 
Sastha Prathap S. 


RI
Replied On September 1, 2016 04:40 AM

Hello Sastha,

i have a function to build pivot with data from database:

$scope.loadPivot = function () {
 
        $("#PivotGrid").remove();
        var pivotGrid = ej.buildTag("div#PivotGrid", "", {
            width: "100%",
            "overflow": "auto",
            "float": "left",
            "margin-top": "20px"
        })[0].outerHTML;

        $(pivotGrid).appendTo(".controls");

        $("#PivotSchemaDesigner").remove();
        var schemaDesigner = ej.buildTag("div#PivotSchemaDesigner", "")[0].outerHTML;
        $(schemaDesigner).appendTo(".PivotSchema");

        $scope.pivotRows = [],
        $scope.pivotColumns = [],
        $scope.pivotValues = [],
        $scope.pivotSlicers = [],

        angular.forEach($scope.PivotData, function (value) {
            if (value.axis == "Rows") {
                $scope.pivotRows.push({
                    fieldName: value.fieldName,
                    fieldCaption: value.fieldName
                });
            }
            if (value.axis == "Columns") {
                $scope.pivotColumns.push({
                    fieldName: value.fieldName,
                    fieldCaption: value.fieldName
                });
            }
            if (value.axis == "values") {
                $scope.pivotValues.push({
                    fieldName: value.fieldName,
                    fieldCaption: value.fieldName
                });
            }
            if (value.axis == "Slicers") {
                $scope.pivotSlicers.push({
                    fieldName: value.fieldName,
                    fieldCaption: value.fieldName
                });
            }
        });


        $("#PivotGrid").ejPivotGrid({
            dataSource: {
                data: $scope.PivotData,
                rows: $scope.pivotRows,
                columns: $scope.pivotColumns,
                values: $scope.pivotValues
            }
        });
    }

in the Console, the data is valid. 
the error occurs here:

    $.grep(tableKeysCalcValues, function (item) {
                            if (item.uniqueName == rowKeysCalcValues[rCnt].uniqueName)
                                for (ky = 0 ; ky < item.value.keys.length; ky++)
                                    calValue.push(item.value.keys[ky]);
                            return;
                        });




JQuery:
grep: function( elems, callback, invert ) {
var callbackInverse,
matches = [],
i = 0,
length = elems.length,
callbackExpect = !invert;

// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
callbackInverse = !callback( elems[ i ], i );
if ( callbackInverse !== callbackExpect ) {
matches.push( elems[ i ] );
}
}

return matches;
},

at this point, elems:

  1. Object
    1. keys:Array[1]
      1. 0:"(blank)"
      2. length:1
      3. __proto__:Array[0]
    2. uniqueName:"(blank)"
    3. value:null
Hope that helps

RI
Replied On September 2, 2016 03:14 AM

Guys,

sorry, please close this thread, its my own stupidity :-), in my load function i call for the
dataSource, data: Scope.PivotData,

PivotData is a string, where my fieldCaption and Name is saved in NOT the data :-D!!

Sorry again and thanks for your help.

Greetings

RI
Replied On September 2, 2016 03:33 AM

Me Again,

the error still occurs, nothing changed!!

please dont close the thread :-(

RI
Replied On September 2, 2016 04:38 AM

Works now!!!!

Sorry for the inconveniences

Sastha Prathap Selvamoorthy [Syncfusion]
Replied On September 2, 2016 04:45 AM

Hi Ruzic, 
  
Thanks for your response. Please contact us for any further assistance. 
  
Regards, 
Sastha Prathap S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;