We were displaying different Context Menu on every node of tree based on some conditions (To be precise some permissions) in our Prime-Faces 5.2 project. Recently we planned to upgrade Prime-Faces library version to newer one 6.0…
As soon as I upgraded my application to use Prime-Faces 6.0 tree component Context Menu started incorrect behavior. It started showing same context menu on each node (Last context menu entry in my XHTML page)…
Even after lot of goggling, we could not find any solution for this as a result of that we started debugging Prime-Faces tree component as we needed to upgrade this for some other fixes…

Solution

While debugging we came across a code in their JavaScript code which was causing this issue… we have fixed this by adding some JavaScript prototype methods in the Project…
I am writing this blog keeping in mind that this can help out some else as well
Solution Java Script