From e1f7c1a1c81b1ef433fa27800730bd4dd8888e6d Mon Sep 17 00:00:00 2001 From: Chen Machluf Date: Tue, 14 Jul 2015 12:23:17 +0300 Subject: [PATCH] remove subgroup from subgroups list if there is no more items in the subgroup. --- lib/timeline/component/Group.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/timeline/component/Group.js b/lib/timeline/component/Group.js index 42ed8621..ae60270a 100644 --- a/lib/timeline/component/Group.js +++ b/lib/timeline/component/Group.js @@ -401,9 +401,14 @@ Group.prototype.remove = function(item) { if(item.data.subgroup !== undefined){ var subgroup = this.subgroups[item.data.subgroup]; - if(subgroup){ + if (subgroup){ var itemIndex = subgroup.items.indexOf(item); subgroup.items.splice(itemIndex,1); + if (!subgroup.items.length){ + delete this.subgroups[item.data.subgroup]; + this.subgroupIndex--; + } + this.orderSubgroups(); } } };