How to use widgetsTree component

The are is my code.

1.database area.
image
image

Hi,

If something doesn’t work, please be more specific about what’s broken.

Regards,
Gleb

Hi,
my problem is use “widgetsTree” but content is no show in page.

1.database area.
image
image

2.java code.
image

3.page
image

4.result
image

Hi,
Display effect is like this video.

AFAIK, it is not documented component and it has been removed since 7.0. Why do you want to use it?

1 Like

Hi,
This is the code template,please help me look.
image
demo.zip (379.2 KB)

Hi Yuriy,
We want a tree for multiselection. For example, allow user to select all subnode of node1, select some subnode of node2, and then do our own logical for all the selected nodes. So we want to add checkbox besides the node, and add listener to them.
Any suggestions?

I would recommend using TreeDataGrid with a single column and selectionMode="MULTI_CHECK".

This is in cuba7.
For cuba6.10, is treeTable ok?

Unfortunately, no. I’ll take a look at your demo project.

Hi Gleb,
If it’s complicated, then never mind. We are going to try add checkbox in program way to treeTable component。

Hi,

It seems that the proper place to define the WidgetBuilder is in the ready method when the datasource is loaded. So, for me the code below produces the following result:

@Override
public void ready() {
    widgetsTree.setWidgetBuilder((datasource, itemId, leaf) -> {
        HBoxLayout layout = componentsFactory.createComponent(HBoxLayout.class);
        layout.setSpacing(true);

        CheckBox checkBox = componentsFactory.createComponent(CheckBox.class);
        layout.add(checkBox);

        Label caption = componentsFactory.createComponent(Label.class);
        OilIssueNormTree item = (OilIssueNormTree) datasource.getItemNN(itemId);
        caption.setValue(item.getName());
        layout.add(caption);

        return layout;
    });
}

53

Hi Gleb,
It works, Thanks~
One more thing, as this widgetsTree is removed from cuba7, so once we upgrade to cuba7, we need another solution, right?

Hi,
i try to over ready method, and the logic code inside,result display is successed.
Thank you.
image

You’re right. As I suggested above, the TreeGrid with a single column and selectionMode="MULTI_CHECK" seems to be the suitable solution.