|
464 | 464 |
|
465 | 465 | /**
|
466 | 466 | * @ngdoc function
|
467 |
| - * @name exporterAllDataPromise |
| 467 | + * @name exporterAllDataFn |
468 | 468 | * @propertyOf ui.grid.exporter.api:GridOptions
|
469 | 469 | * @description This promise is needed when exporting all rows,
|
470 | 470 | * and the data need to be provided by server side. Default is null.
|
471 | 471 | * @returns {Promise} a promise to load all data from server
|
472 | 472 | *
|
473 | 473 | * @example
|
474 | 474 | * <pre>
|
475 |
| - * gridOptions.exporterAllDataPromise = function () { |
| 475 | + * gridOptions.exporterAllDataFn = function () { |
476 | 476 | * return $http.get('/data/100.json')
|
477 | 477 | * }
|
478 | 478 | * </pre>
|
479 | 479 | */
|
480 |
| - gridOptions.exporterAllDataPromise = gridOptions.exporterAllDataPromise ? gridOptions.exporterAllDataPromise : null; |
| 480 | + gridOptions.exporterAllDataFn = gridOptions.exporterAllDataFn ? gridOptions.exporterAllDataFn : null; |
| 481 | + |
| 482 | + /** |
| 483 | + * @ngdoc function |
| 484 | + * @name exporterAllDataPromise |
| 485 | + * @propertyOf ui.grid.exporter.api:GridOptions |
| 486 | + * @description DEPRECATED - exporterAllDataFn used to be |
| 487 | + * called this, but it wasn't a promise, it was a function that returned |
| 488 | + * a promise. Deprecated, but supported for backward compatibility, use |
| 489 | + * exporterAllDataFn instead. |
| 490 | + * @returns {Promise} a promise to load all data from server |
| 491 | + * |
| 492 | + * @example |
| 493 | + * <pre> |
| 494 | + * gridOptions.exporterAllDataFn = function () { |
| 495 | + * return $http.get('/data/100.json') |
| 496 | + * } |
| 497 | + * </pre> |
| 498 | + */ |
| 499 | + if ( gridOptions.exporterAllDataFn == null && gridOptions.exporterAllDataPromise ) { |
| 500 | + gridOptions.exporterAllDataFn = gridOptions.exporterAllDataPromise; |
| 501 | + } |
481 | 502 | },
|
482 | 503 |
|
483 | 504 |
|
|
586 | 607 | * @ngdoc function
|
587 | 608 | * @name loadAllDataIfNeeded
|
588 | 609 | * @methodOf ui.grid.exporter.service:uiGridExporterService
|
589 |
| - * @description When using server side pagination, use exportAllDataPromise to |
| 610 | + * @description When using server side pagination, use exporterAllDataFn to |
590 | 611 | * load all data before continuing processing.
|
591 | 612 | * When using client side pagination, return a resolved promise so processing
|
592 | 613 | * continues immediately
|
|
599 | 620 | * uiGridExporterConstants.SELECTED
|
600 | 621 | */
|
601 | 622 | loadAllDataIfNeeded: function (grid, rowTypes, colTypes) {
|
602 |
| - if ( rowTypes === uiGridExporterConstants.ALL && grid.rows.length !== grid.options.totalItems && grid.options.exporterAllDataPromise) { |
603 |
| - return grid.options.exporterAllDataPromise() |
| 623 | + if ( rowTypes === uiGridExporterConstants.ALL && grid.rows.length !== grid.options.totalItems && grid.options.exporterAllDataFn) { |
| 624 | + return grid.options.exporterAllDataFn() |
604 | 625 | .then(function() {
|
605 | 626 | grid.modifyRows(grid.options.data);
|
606 | 627 | });
|
|
0 commit comments