Browse Source

remove subgroup from subgroups list if there is no more items in the subgroup.

flowchartTest
Chen Machluf 9 years ago
parent
commit
e1f7c1a1c8
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      lib/timeline/component/Group.js

+ 6
- 1
lib/timeline/component/Group.js View File

@ -401,9 +401,14 @@ Group.prototype.remove = function(item) {
if(item.data.subgroup !== undefined){ if(item.data.subgroup !== undefined){
var subgroup = this.subgroups[item.data.subgroup]; var subgroup = this.subgroups[item.data.subgroup];
if(subgroup){
if (subgroup){
var itemIndex = subgroup.items.indexOf(item); var itemIndex = subgroup.items.indexOf(item);
subgroup.items.splice(itemIndex,1); subgroup.items.splice(itemIndex,1);
if (!subgroup.items.length){
delete this.subgroups[item.data.subgroup];
this.subgroupIndex--;
}
this.orderSubgroups();
} }
} }
}; };

Loading…
Cancel
Save