-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Selected Nodes stays in selectedNodeData permanently after being deleted #45
Comments
To explain this further, when I programatically delete an element from the elements list (i.e.e select node and click 'button' to delete, and also try to clear the selection from ' |
Could you share a minimal reproducible Dash app with the error? |
Let me try. I am struggling to create examples, as there are so many functions that together result in this. In the meanwhile, would it work if I invite you temporarily to my private repository? Thanks. |
Don't worry, take your time! I think it's better if you create a barebone, simple reproducible app, and share it here. That way, it makes it easier for us to debug (faster than taking the time to understand your entire workflow), and we don't need to look at your private data. Furthermore, creating a reproducible example might help you debug your code, if the problem happens in the implementation side. Also, people who will have a similar problem will be able to find the solution directly in this issue, which saves them time in the future. |
I see- that's fair. Let me try to get a simple working example. |
@vivekvs1 I didn't register this part when I first read your issue. It is not possible to modify "selectedNodeData" (or any other event prop) using Dash callbacks. |
Oh I see. Then how do I change the selection programatically? One way I did was to modify the elements list to make the node I want to be "selected":True. However, in my case, I want to be able to 'select' the node and use a pushbutton for deleting the node. In this case, I wont be able to pass 'selected:'False before removing the element from list - if you know what I mean. Because of this, 'selectedNodeData' has permanant memory of the deleted element, even thought that was removed from the elements list. |
This behavior is definitely not intended, but it will likely take a lot of work to modify the React wrapper (Cytoscape.react.js) in order to account for deleted nodes. I'll add this as an objective for v0.1.1, but it might take more time to get fixed depending on its difficulty. If you would like to try this out, feel free to take a look at how the Cytoscape wrapper works ( |
I see- thank you. Sure- I'll take a look. I don't know if I am qualified enough- but I would like to try and take a shot at it! Thanks @xhlulu !! As an alternative, if you can think of any other creative alternative, please share. Thanks! |
As a workaround, have you tried using two buttons; one to store all the selected nodes in a hidden |
If you provide an example it would be very easy for me to test out this solution. |
Yes- I will on Monday. Sorry- my current code atm is pretty complex due to other dependencies - I shall simplify before sharing. But I'll do so asap. I actually think that your solution might work. So I can use a combination of tapNodeData and delete pushbutton, and remove the use of the selectedNodeData completely. |
No - nevermind. Maybe it won't work - now that I think deeper. I'll share my use case soon to make my point more clear. Thanks. |
What if you store the list of deleted nodes in a hidden
Obviously a pseudocode, but it could be a quick fix for your situation |
If this workaround solves your problem, please do not close this issue. The team will close this when the actual problem has been fixed. |
Oh you mean like a second hidden div for Thanks very much @xhlulu . Yes I shall not close the thread and keep an eye on this issue. |
Thank you. In the meantime feel free to share a reproduceable example if you have the time. |
I was able to reproduce your error. I was able to fix it by tweaking the source code. Here's the branch where I brought the changes: https://github.com/plotly/dash-cytoscape/tree/element-removal I added an example app here. Here's what it looks like: |
please look at the contributing.md file to see how to use the package locally |
Wow great! I still haven't managed to figure out to use the packages locally- I really also want to trial out the extra layout options. Maybe I'll sit through it today and see. |
Hi,
When I try to update the selected nodes using a callback to modify either '
selectedNodeData
' or 'tapNode
' or 'tapNodeData
' is not reflecting on the front-end. i.e. the selection highlight is not changing automatically.Thanks,
Vivek
The text was updated successfully, but these errors were encountered: