The first right-click will show 'undefined' selected item. Clicking outside of the tree and then right-click again will keep on showing undefined. Selecting one, and then and then right-clicking another will show the id of the previously selected one.
ABAshokkumar Balasubramanian Syncfusion Team August 26, 2019 06:25 AM
We have checked the reported issue and it was due to in some cases the beforeOpen event gets triggered even before the SelectedNode value gets initialized. So, you can use the following code snippet to get the target tree node in the beforeOpen event of the context menu.