Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Conversation

@lewisjb
Copy link
Contributor

@lewisjb lewisjb commented Jan 3, 2017

Quote from docs: "groups can be an Array with Objects, a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding)".

However, in #2315 the array support was broken.

The specific change can be seen by comparing develop to master

The problem is groups.filter(filter), because filter is:

var filter = {
  filter : function(group){
    return group.visible !== false;
  }
}

groups should be an Array, so groups.filter is expecting a function, but is given an object. This results in Uncaught TypeError: #<Object> is not a function (to test for yourself just put [].filter({}) in your development console).

So I changed filter to be the function, and pass in {filter: filter} to DataView. I felt this was a cleaner solution than passing in filter.filter to groups.filter because the function is the shared information.

@yotamberk yotamberk merged commit d3d1dc7 into visjs:develop Jan 3, 2017
@lewisjb lewisjb deleted the fix-set-groups-array branch January 4, 2017 00:52
@mojoaxel mojoaxel added this to the Minor Release v4.18 milestone Jan 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants