Skip to content

Commit

Permalink
Merge pull request Addepar#148 from LetsMakeDataEasy/group-row-contro…
Browse files Browse the repository at this point in the history
…ll-flags

Add group row control flags.
  • Loading branch information
tdriscoll committed Oct 29, 2015
2 parents d4fc8b2 + 45dd7c7 commit 720323a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 10 additions & 1 deletion addon/controllers/group-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var GroupRow = Row.extend({
_childrenRow: null,

expandChildren: function () {
if (this.get('_groupRowControlFlags.isEmpty')) {
return;
}
this.set('isExpanded', true);
this.createChildrenRow();
var target = this.get('target');
Expand All @@ -43,6 +46,9 @@ var GroupRow = Row.extend({
},

collapseChildren: function () {
if (this.get('_groupRowControlFlags.isEmpty')) {
return;
}
this.set('isExpanded', false);
var target = this.get('target');
if (target) {
Expand Down Expand Up @@ -199,7 +205,10 @@ var GroupRow = Row.extend({
return this.get('grouping.isGrandTotal') ? this.get('grouping.grandTotalClass') : '';
}),

hasChildren: Ember.computed('grouping.isGrandTotal', function() {
hasChildren: Ember.computed('grouping.isGrandTotal', '_groupRowControlFlags.isEmpty', function() {
if (this.get('_groupRowControlFlags.isEmpty')) {
return false;
}
return this.get('grouping.isGrandTotal') || this.get('grouping.isGroup');
}),

Expand Down
4 changes: 1 addition & 3 deletions addon/views/grouping-column-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export default TableCell.extend(

_defaultGroupIndicatorViewName: 'grouped-row-indicator',

hasChildren: Ember.computed(function() {
return this.get('row.hasChildren') || this.get('groupingLevel') < this.get('tableComponent.groupingMetadata.length') - 1;
}).property('groupingLevel', 'tableComponent.groupingMetadata.length'),
hasChildren: Ember.computed.oneWay('row.hasChildren'),

expandLevel: Ember.computed.oneWay('row.expandLevel'),

Expand Down

0 comments on commit 720323a

Please sign in to comment.