Today, I want to add a function to cancel selection of a tree item in tree panel.
I already implementated this before, but I can’t remember how to do this.
So I search the original code and save here, so next time, I can find it from here.
treePanel.getSelectionModel().addListener(Events.BeforeSelect, new Listener<SelectionEvent<ModelData>>() { @Override public void handleEvent(SelectionEvent<ModelData> be) { // Get the model data ModelData model = be.getModel();// Check the model data and if want to cancel selection, then set canceled value if (model.get("disableSelect") != null) { be.setCancelled(true); } } }); |