conditionally prevent tree node selection #2097
Unanswered
zachsteffens
asked this question in
PrimeNG
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've got a p-tree that displays details when a tree node is selected. If any of those details are changed, I'd need to the user to save before they can navigate to a different node in the tree or away from the page entirely. I am using an Angular CanDeactivate guard to show a confirmation dialog when the user tries to navigate to a different page, but I'm having trouble doing something similar when a tree node is selected.
my pseudo-code is essentially
But as far as I can tell, there is no way to intercept the nodeSelected event to inject this sort of code so I can stop the event propagation.
Am I missing something obvious?
I could use the "selectable" property on the nodes to prevent navigation, but users will have very limited context clues as to why they cant select a different node. I'd like to keep the UX for leaving the page and selecting a different node as similar as possible.
Beta Was this translation helpful? Give feedback.
All reactions