Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(grouping): Add option groupingNullLabel, #3431

Merged
merged 1 commit into from
May 19, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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