I am using angular grid ui and I am trying to get the vaule of cell based on the row and column using getCellValue.
I am getting the error
Unable to get property '$$undefined' of undefined or null reference
How do I get the vaule from a cell based on the row and the column?
angular.module('app', ['ngAnimate', 'ngTouch', 'ui.grid','ui.grid.resizeColumns','ui.grid.pinning','ui.grid.grouping',
'ui.grid.moveColumns','ui.grid.exporter','ui.grid.selection','ui.grid.selection', 'ui.grid.cellNav']).controller('MainCtrl', MainCtrl);
MainCtrl.$inject = ['$http', 'uiGridConstants','$interval','$scope'];
function MainCtrl($http, uiGridConstants,$scope) {
var vm = this;
vm.gridOptions = { //vm
exporterMenuCsv: true,
enableGridMenu:true,
onRegisterApi: function(gridApi){
vm.gridApi = gridApi; //vm
}
};
$http.get('/getProjects')
.then(function(response) {
//Loop through the response
//If the vaule is 255 set the color of the cell to ect.
var responseData = response.data
console.log(vm.gridApi.grid.getCellValue(1,1));
//console.log(responseData[i].Iuk)
});
}
The injection array doesn't match the parameters of the function:
MainCtrl.$inject = ['$http', 'uiGridConstants','$interval','$scope'];
function MainCtrl($http, uiGridConstants,$scope) {
From the Docs:
$inject
Property AnnotationWhen using this type of annotation, take care to keep the annotation array in sync with the parameters in the function declaration.
This problem can be avoided by using Implicit Annotation. Tools like ng-annotate let you use implicit dependency annotations in your app and automatically add array annotations prior to minifying.