Reputation: 276
I am working on an org chart with go.js.
One thing I am not able to figure out is, how do I filter on particular nodes? Is it possible to have a UI for searching nodes in go.js?
Upvotes: 3
Views: 2077
Reputation: 63802
There's a search box in the org chart static sample that gives an example of filtering nodes.
// create a case insensitive RegExp from what the user typed
var regex = new RegExp(input.value, "i");
...
// search four different data properties for the string, any of which may match for success
var results = myDiagram.findNodesByExample({ name: regex },
{ nation: regex },
{ title: regex },
{ headOf: regex });
See the documentation for findNodesByExample for more information.
Upvotes: 3