Search code examples
gwtgxt

How do I add a click handler to a TreePanel in GXT 2.11?


There is a similar question to this for ExtJS but not for GXT.

I wish to simply add an onclick handler to a TreePanel in GXT. That is, I wish to perform an operation when a user clicks on a node in the tree. The showcase does not seem to cover this most basic usecase.

Thanks,


Solution

  • Premature cry for help it seems.

    This seems to do the trick:

            treePanel.addListener(Events.OnClick, new Listener<TreePanelEvent<ModelData>>() {
                public void handleEvent(TreePanelEvent<ModelData> be) {
                    // do something here
                };
            });