javascript - Scroll to end to grid UI-Grid Angular js -
i want scroll end of grid when data loaded. code not working. please help
$scope.adddata = function () { var n = $scope.gridoptions.data.length + 1; $scope.gridoptions.data.push({ "type":"student", "is_job_ready":"true", "is_night_shift":"true" }); $scope.scrollto($scope.gridoptions.data.length -1,0) }; $scope.scrollto = function( rowindex, colindex ) { $scope.gridapi.core.scrollto( $scope.gridoptions.data[rowindex],$scope.gridoptions.columndefs[colindex]); };
you need include module js code:
ui.grid.cellnav
then, scroll going work:
$scope.gridapi.core.scrollto($scope.gridoptions.data[$scope.gridoptions.data.length - 1], $scope.gridoptions.columndefs[0]);
Comments
Post a Comment