Controlling Context menu in tree grid

Scenario: I have a treegrid with the context menu enabled. In the treegrid i have the parent nodes disabled and user can select only the child nodes. I am disabling the menu when the user right clicks on the disabled parent nodes. I enable the menu and its functions only when the user right clicks on the child nodes.

Issue: When a user selects a child node and right clicks on any place on the treegrid the menu shows up for the selected child node which is visually misleading when the user right clicks on the disabled node or any other empty part of the grid.

Question: I either need to show the disabled menu again when the user right clicks on any other part of the treegird (or other option)When the user selects a record, menu should be displayed only when he right clicks on that particular highlighted row or a cell and when he moves out the menu should hide.

This seems like something that can be accomplished via nodeContextClick and some logic to look at whether the node for the current row is disabled/ is a parent?