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. Image for the cookie policy date

Cannot read property 'keys' of null

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



6 Replies

SP Sastha Prathap Selvamoorthy Syncfusion Team September 1, 2016 06:26 AM UTC

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 RI September 1, 2016 08:40 AM UTC

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 RI September 2, 2016 07:14 AM UTC

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 RI September 2, 2016 07:33 AM UTC

Me Again,

the error still occurs, nothing changed!!

please dont close the thread :-(


RI RI September 2, 2016 08:38 AM UTC

Works now!!!!

Sorry for the inconveniences


SP Sastha Prathap Selvamoorthy Syncfusion Team September 2, 2016 08:45 AM UTC

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


Loader.
Up arrow icon