View Full Version : How to know whether a treegrid (treepanel) has been selected?

Mar 17, 2011, 11:05 AM

I have a question here.

We can get the selected treenode using #{TreeGrid}.getSelectionModel().getSelectedNode(). But if no treenode is selected, it will cause an error. What I want is: if there is one treenode selected, get the selected treenode; if no treenode is selected, return a specific value(i.e. -1).

How can I make it? If anyone knows, tell me please. Thanks a lot.

The following is my code, but it cause error.

<ext:Parameter Name="Node" Mode="Raw" Encode="true"
Value="#{TreeGrid}.getSelectionModel().hasSelection() ? #{TreeGrid}.convertToSubmitNode(#{TreeGridc}.getSe lectionModel().getSelectedNode()) : -1" />