-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Generate an element without adding it to the graph #3015
Replies: 1 comment · 6 replies
-
It sounds like this isn't supported by an existing function. Are you interested in making a PR for this feature? |
Beta Was this translation helpful? Give feedback.
All reactions
-
It sounds like a good idea. It ought to be possible, since you can have removed elements -- as you mentioned. It probably makes sense to start with the constructor by adding support for creating a collection that starts off in the removed state: cytoscape.js/src/collection/index.js Lines 25 to 121 in 56fdab6
Then you could create a higher level function that uses your new feature. Maybe you could reuse the What do you think? |
Beta Was this translation helpful? Give feedback.
All reactions
-
Another small related question, would there be any way to make a removed node a parent of a node? (it would also be a removed node in this case) It doesn't seem to currently let me make a node that has been collapsed (I.E. removed) by the expand collapse library the parent of a node in the graph using the move functionality. The use case I want to achieve is:
|
Beta Was this translation helpful? Give feedback.
All reactions
-
Sure, that all makes sense, I'll start fiddling around with it. |
Beta Was this translation helpful? Give feedback.
All reactions
-
Maybe you could allow (2) as a part of (1). Unit tests would be useful to verify. (3) sounds like it's up to the extension to manage. |
Beta Was this translation helpful? Give feedback.
All reactions
-
Yeah, I have already confirmed (3) works and I will do it externally. Looking at your element constructor it seems you might already have this functionality. What happens when you don't run restore after creating it? Or at the end of the collection constructor? cytoscape.js/src/collection/element.js Lines 6 to 128 in 56fdab6
|
Beta Was this translation helpful? Give feedback.
-
Is there any way to generate a full Cytoscape node or edge without it being added to the graph? Like have it exist in a removed state or something?
I have a weird use case for this with the Expand-Collapse extension. I want to create these and add them to the
collapsedChildren
data point of their parent collapsed node, which will then add them to the graph if the parent node is ever expanded.I have already confirmed I can add the nodes to this data point after they have been removed and everything works as expected, I am just hoping to skip the step of them being added and rendered in the graph first in order to be more optimized.
Beta Was this translation helpful? Give feedback.
All reactions