From 9726da595bd1fcb4c5c7264a53fed28f02d69a55 Mon Sep 17 00:00:00 2001 From: Kevin Bedi Date: Thu, 4 Apr 2019 17:29:18 -0700 Subject: [PATCH] Fix `useDefaultGroups` option in Groups module The docs (http://visjs.org/docs/network/groups.html#) indicate that if `useDefaultGroups` is passed as false, it will iterate through the provided groups to use as defaults instead. But the code doesn't seem to match that description, as `useDefaultGroups` is ignored, and the code that handles it being false doesn't seem quite right (it should fetch the full group, not just the color) --- lib/network/modules/Groups.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/network/modules/Groups.js b/lib/network/modules/Groups.js index bddd13ad1..f5d967c6d 100644 --- a/lib/network/modules/Groups.js +++ b/lib/network/modules/Groups.js @@ -59,6 +59,8 @@ class Groups { if (optionFields.indexOf(groupName) === -1) { let group = options[groupName]; this.add(groupName, group); + } else { + this.options[groupName] = options[groupName]; } } } @@ -90,8 +92,7 @@ class Groups { // create new group let index = this.groupIndex % this.groupsArray.length; this.groupIndex++; - group = {}; - group.color = this.groups[this.groupsArray[index]]; + group = this.groups[this.groupsArray[index]]; this.groups[groupname] = group; } else {