Skip to content

Commit

Permalink
Merge pull request #3431 from AgDude/issue-grouping-null
Browse files Browse the repository at this point in the history
feat(grouping): Add option groupingNullLabel,
  • Loading branch information
PaulL1 committed May 19, 2015
2 parents 42b789a + 9fbb1b8 commit 9adca3d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/features/grouping/js/grouping.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,15 @@
* <br/>Defaults to true
*/
gridOptions.groupingShowCounts = gridOptions.groupingShowCounts !== false;

/**
* @ngdoc object
* @name groupingNullLabel
* @propertyOf ui.grid.grouping.api:GridOptions
* @description The string to use for the grouping header row label on rows which contain a null or undefined value in the grouped column.
* <br/>Defaults to "Null"
*/
gridOptions.groupingNullLabel = gridOptions.groupingNullLabel || 'Null';
},


Expand Down Expand Up @@ -1140,7 +1149,7 @@
var updateProcessingState = function( groupFieldState, stateIndex ) {
var fieldValue = grid.getCellValue(row, groupFieldState.col);
if ( typeof(fieldValue) === 'undefined' || fieldValue === null ){
return;
fieldValue = grid.options.groupingNullLabel;
}

if ( !row.visible ){
Expand Down Expand Up @@ -1287,6 +1296,9 @@

// TODO: can't just use entity like this, have to use get cell value, need col for that
var newValue = grid.getCellValue(renderableRows[rowIndex], col);
if ( typeof(newValue) === 'undefined' || newValue === null ) {
newValue = grid.options.groupingNullLabel;
}
headerRow.entity[fieldName] = newValue;
headerRow.groupLevel = stateIndex;
headerRow.groupHeader = true;
Expand Down

0 comments on commit 9adca3d

Please sign in to comment.