xfscrypt
xfscrypt

Reputation: 276

How to filter nodes in gojs in the UI?

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

Answers (1)

Simon Sarris
Simon Sarris

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

Related Questions