Skip to content

Commit 7980717

Browse files
committed
Merge pull request #3510 from PaulL1/fixes2
Fixes2
2 parents 5cc044d + 0874b42 commit 7980717

File tree

11 files changed

+163
-60
lines changed

11 files changed

+163
-60
lines changed

misc/tutorial/201_editable.ngdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ allowing use of the bootstrap datepicker and input fields_
6464

6565
<pre>
6666
$scope.gridOptions.columnDefs = [
67-
{ name: 'name', enableCellEdit: true, editableCellTemplate: 'xxxxxxx' },
67+
{ name: 'name', enableCellEdit: true },
6868
{ name: 'age', enableCellEdit: true, type: 'number'},
6969
{ name: 'registered', displayName: 'Registered' , type: 'date'},
7070
{ name: 'address', displayName: 'Address', type: 'object'},

misc/tutorial/309_editable_with_cellnav.ngdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ of combining cellNav and edit to give a more spreadsheet-like experience.
2323
{ name: 'id', enableCellEdit: false, width: '10%' },
2424
{ name: 'name', displayName: 'Name (editable)', width: '20%' },
2525
{ name: 'age', displayName: 'Age' , type: 'number', width: '10%' },
26-
{ name: 'gender', displayName: 'Gender', editType: 'dropdown', width: '20%',
26+
{ name: 'gender', displayName: 'Gender', editableCellTemplate: 'ui-grid/dropdownEditor', width: '20%',
2727
cellFilter: 'mapGender', editDropdownValueLabel: 'gender', editDropdownOptionsArray: [
2828
{ id: 1, gender: 'male' },
2929
{ id: 2, gender: 'female' }

misc/tutorial/405_exporting_all_data_complex.ngdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This shows combined external pagination and sorting.
3232
{ name: 'gender', enableSorting: false },
3333
{ name: 'company', enableSorting: false }
3434
],
35-
exporterAllDataPromise: function() {
35+
exporterAllDataFn: function() {
3636
return getPage(1, $scope.gridOptions.totalItems, paginationOptions.sort)
3737
.then(function() {
3838
$scope.gridOptions.useExternalPagination = false;

src/features/exporter/js/exporter.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,20 +464,41 @@
464464

465465
/**
466466
* @ngdoc function
467-
* @name exporterAllDataPromise
467+
* @name exporterAllDataFn
468468
* @propertyOf ui.grid.exporter.api:GridOptions
469469
* @description This promise is needed when exporting all rows,
470470
* and the data need to be provided by server side. Default is null.
471471
* @returns {Promise} a promise to load all data from server
472472
*
473473
* @example
474474
* <pre>
475-
* gridOptions.exporterAllDataPromise = function () {
475+
* gridOptions.exporterAllDataFn = function () {
476476
* return $http.get('/data/100.json')
477477
* }
478478
* </pre>
479479
*/
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+
}
481502
},
482503

483504

@@ -586,7 +607,7 @@
586607
* @ngdoc function
587608
* @name loadAllDataIfNeeded
588609
* @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
590611
* load all data before continuing processing.
591612
* When using client side pagination, return a resolved promise so processing
592613
* continues immediately
@@ -599,8 +620,8 @@
599620
* uiGridExporterConstants.SELECTED
600621
*/
601622
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()
604625
.then(function() {
605626
grid.modifyRows(grid.options.data);
606627
});

src/features/exporter/test/exporter.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ describe('ui.grid.exporter uiGridExporterService', function () {
8484
exporterMenuCsv: true,
8585
exporterMenuPdf: true,
8686
exporterFieldCallback: jasmine.any(Function),
87-
exporterAllDataPromise: null,
87+
exporterAllDataFn: null,
8888
exporterSuppressColumns: []
8989
});
9090
});
9191

92-
it('set all options to non-default', function() {
92+
it('set all options to non-default, including using deprecated exporterAllDataPromise', function() {
9393
var callback = function() {};
9494
options = {
9595
exporterSuppressMenu: true,
@@ -135,6 +135,7 @@ describe('ui.grid.exporter uiGridExporterService', function () {
135135
exporterMenuCsv: false,
136136
exporterMenuPdf: false,
137137
exporterFieldCallback: callback,
138+
exporterAllDataFn: callback,
138139
exporterAllDataPromise: callback,
139140
exporterSuppressColumns: [ 'buttons' ]
140141
});

src/features/grouping/js/grouping.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,8 +887,8 @@
887887
* @param {Grid} grid grid object
888888
*/
889889
tidyPriorities: function( grid ){
890-
// if we're called from sortChanged, grid is in this, not passed as param
891-
if ( typeof(grid) === 'undefined' && typeof(this.grid) !== 'undefined' ) {
890+
// if we're called from sortChanged, grid is in this, not passed as param, the param can be a column or undefined
891+
if ( ( typeof(grid) === 'undefined' || typeof(grid.grid) !== 'undefined' ) && typeof(this.grid) !== 'undefined' ) {
892892
grid = this.grid;
893893
}
894894

0 commit comments

Comments
 (0)