Search code examples
smartgwt

How to make the last Item a leaf when TreePick is populate by a DataSource?


I'm using SmartGWT 2.5.

I would like to use the same example showed here

As you can see for the Department menu, we can 'setCanSelectParentItems(false) For Category menu, if wesetCanSelectParentItems(false), it allows us to select only the null item with label[Empty Menu]`.

I would like to make the last Item a leaf when TreePick is populate by a DataSource? And then disable parent selection with mCategory.setCanSelectParentItems(false);

Could you tell me how to do that?


Solution

  •     categoryItem.setDataSource(dataSource);  
        categoryItem.setEmptyMenuMessage("No Sub Categories");  
        categoryItem.setCanSelectParentItems(true);          
        categoryItem.setLoadDataOnDemand(false);
        dataSource.fetchData();  
    

    // Set Load on Demand to false