当 TreePick 由数据源填充时,如何使最后一个项目成为叶子?

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

我正在使用 SmartGWT 2.5。

我想用同样的例子显示 here

如您所见,对于“部门”菜单,我们可以“setCanSelectParentItems(false) For Category menu, if wesetCanSelectParentItems(false), it allows us to select only the null item with label[空菜单]”。

当 TreePick 由 DataSource 填充时,我想将最后一个 Item 设为叶子?然后使用 mCategory.setCanSelectParentItems(false);

禁用父选择

你能告诉我怎么做吗?

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

// 将按需加载设置为 false