Hi,
I'm using version v3.1.1 of ui-grid. I'm trying to use on.rowsRendered and I get the error in the subject.
Here's my code, with a lot of column defs snipped out:
var myTestApp = angular.module('Test', ["ui.router", "ui.grid", "ui.grid.pagination"]);
myTestApp.controller('myTestController', function($scope, $http, uiGridConstants){
$scopemyTestGrid = {
columnDefs: [
{
displayName: "Client's Name",
field: 'client_last_name',
cellTemplate: 'partials/app/myapp/clients/client_first_last.php',
width: "30%",
enableFiltering: true,
},
],
rowHeight: 40,
enableFiltering: true,
enableColumnMenus: false,
paginationPageSizes: [25, 50, 75],
paginationPageSize: 25,
onRegisterApi: function(gridApi) {
$scope.gridApi = gridApi;
$scope.gridApi.core.on.rowsRendered($scope, test('asdf'));
}
};In another file that is included and does run:
function test(msg){ alert(msg); }
TypeError: Cannot read property 'apply' of undefined
at https://my.server.com/myapp/bower_components/angular-ui-grid/ui-grid.min.js:7:30735
at m.$emit (https://my.server.com/myapp/bower_components/angular/angular.min.js:147:47)
at Object.f.raise.(anonymous function) [as rowsRendered] (https://my.server.com/myapp/bower_components/angular-ui-grid/ui-grid.min.js:7:31771)
at p.setVisibleRows (https://my.server.com/myapp/bower_components/angular-ui-grid/ui-grid.min.js:7:18921)
at https://my.server.com/myapp/bower_components/angular-ui-grid/ui-grid.min.js:7:17028
at https://my.server.com/myapp/bower_components/angular/angular.min.js:130:409
at m.$eval (https://my.server.com/myapp/bower_components/angular/angular.min.js:145:107)
at m.$digest (https://my.server.com/myapp/bower_components/angular/angular.min.js:142:173)
at m.$apply (https://my.server.com/myapp/bower_components/angular/angular.min.js:145:401)
at l (https://my.server.com/myapp/bower_components/angular/angular.min.js:97:250)(anonymous function)My goal is to have the function eventually set the height of the grid's containing element depending on the number of rows displayed. So maybe there's a better way to do that? It would have to be as simple, because using the function works even with the console errors.
Is it a bug or a feature and I don't have the syntax right? Commenting out the rowsRendered line makes the error go away.
Thanks!
- @rramsey