AngularJS-从ui网格导出PDF/CSV时出错
嗨,我遵循的程序与下面的程序相同 它的工作正常。但我只是添加了下面的代码,以便在gridOptions之后从表中导出数据,如下所示,给出错误gridApi未定义,请建议,但没有AngularJS-从ui网格导出PDF/CSV时出错,angularjs,Angularjs,嗨,我遵循的程序与下面的程序相同 它的工作正常。但我只是添加了下面的代码,以便在gridOptions之后从表中导出数据,如下所示,给出错误gridApi未定义,请建议,但没有init()/then(),simple controller export正在工作 $scope.gridOptions = { paginationPageSizes: [25, 50, 75], paginationPageSize: 25, useExternalPagination: t
init()
/then()
,simple controller export正在工作
$scope.gridOptions = {
paginationPageSizes: [25, 50, 75],
paginationPageSize: 25,
useExternalPagination: true,
useExternalSorting: true,
rowTemplate : 'rowTemplate.html',
columnDefs: [
{ name: $scope.translate.EQUIPMENT_NAME, field: 'equipmentName' },
{ name: $scope.translate.EQUIPMENT_TYPE, field: 'equipmentType.equipmentType' },
{ name: $scope.translate.CREATION_DATE, field: 'creationDate' },
{ name: $scope.translate.ACTION, cellTemplate:'cellTemplate.htm'}
],
exporterSuppressColumns: [ $scope.translate.ACTION ],
onRegisterApi: function(gridApi) {
console.log('grid table fun');
//currentSortColumns = $scope.gridOptions.columnDefs[0].field;
$scope.gridApi = gridApi;
//$scope.gridApi.core.on.sortChanged( $scope, $scope.sortChanged );
//$scope.sortChanged($scope.gridApi.grid, [ $scope.gridOptions.columnDefs[0] ] );
gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
paginationOptions.pageNumber = newPage;
paginationOptions.pageSize = pageSize;
//$scope.sortChanged($scope.gridApi.grid, currentSortColumns );
getPage();
});
}
};
$scope.export = function(){
//alert("hii");
console.log($scope.export_format);
if ($scope.export_format == 'csv') {
var myElement = angular.element(document.querySelectorAll(".custom-csv-link-location"));
$scope.gridApi.exporter.csvExport( $scope.export_row_type, $scope.export_column_type, myElement );
} else if ($scope.export_format == 'pdf') {
$scope.gridApi.exporter.pdfExport( $scope.export_row_type, $scope.export_column_type );
};
};
Hi@luxor001 suggest pleaseError:$scope.gridApi未定义$scope。export@file:///D:/DB/Angular js…….Hi@luxor001 suggest pleaseError:$scope.gridApi未定义$scope。export@file:///D:/DB/js。。。。。。。