PDA

View Full Version : Single Check - TreePanel



micgala
3 Sep 2009, 7:12 AM
Hi.

Is it possible to restrict the number of checked items in the TreePanel as 1?
I mean, is it possible to use a "SingleCheckModel"... something like this.
I would need to have only one selected item a time.

If someone knows how to accomplish this, please let me know.

Regards,
Michel.

yafmbl
4 Sep 2009, 1:18 AM
Hi ,
I wanted this simple thing too,once upon a time.
That is not related with selectionmodel.
What u have to do is below.
Listen BeforeCheckChange, disable events, deselect previous one,
enable events again



TreePanelInstance.addListener( Events.BeforeCheckChange, new Listener<BaseEvent>( )
{
@Override
public void handleEvent( BaseEvent be )
{
TreePanelInstance.disableEvents( true ) ;

List<BaseModel> previosCheckeds = this.tree.getCheckedSelection( ) ;
for( BaseModeld : previosCheckeds )
TreePanelInstance.setChecked( d, false ) ;

TreePanelInstance.disableEvents( false ) ;

micgala
4 Sep 2009, 1:49 AM
Hi.

Tks a lot for your response.
That was quite helpful.

Regards,
Michel.