-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding new data to collapsed workspace #136
Comments
You should write a recursive function and find the collapsed node. Collapsed nodes are removed from cytoscape.js but they stay in the memory. You should investigate |
So I am able to just insert a cytoscape node object into the Have you considered making an object map for nodes that are removed when clustered to get quick simple access to important datapoints? I know there are ways to get these objects currently, but it's not very performant to do repeatedly, and it seems like it would be simple and quick to update the references to these objects when they get clustered. Something like this
I could also create and update a map like this on my application side if the |
Did you find an approach that allows you too add collapsedChildren nodes? I am in a similar situation, needing to add collapsedChildren and edges to the collapsedChildren. |
@jacksonneal I'm still working on it but I think I found a method that should work. You can create a map to locate the nodes even after they are removed due to collapsing. The node objects that are there in the graph before collapsing are the same objects inside of the collapsedChildren collection of collapsed nodes. So make a map to reference all the node objects before they become collapsed and then you can add the nodes to their respective parent's Currently you will need to add the node to the graph, use I'm currently trying to figure out a way to make a clone of a node to use as a base to copy, edit, and and merge it into the collection without having to add it to the cytoscape graph first. |
@Alexithemia I think if you are going to add NEW elements to collapsed children, you should add them to Cytoscape.js. Otherwise, there is no similar thing to a node "constructor" or "creator" function. Secondly, I see that API has |
@canbax I'm not really creating a function to get all the children, I am simply adding the node objects to a node map I have created for other uses as they are added to the graph, before they are collapsed. This object is the same after it is removed and collapsed under other nodes. That way I can easily access them by going |
Ok. Still you can use |
I am finding it difficult to add new data to an already collapsed workspace, specifically when I am adding nodes that should be collapsed under nodes that have already been collapsed.
Expanding the whole graph and then collapsing again after loading is probably the easiest thing to do, but seems a little overkill and requires a lot of processing and load time.
I also attempted programmatically finding which nodes to expand, then collapse those nodes again afterwards, but that runs even slower.
Is there a simple way I am missing? Could we possibly just generate a cytoscape node object and attach it under the correct parent's 'collapsedChildren' datapoint?
The text was updated successfully, but these errors were encountered: