Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree selection of subitems does not work when tree was not collapsed before #999

Closed
JuliusRuppert opened this issue Jan 24, 2025 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@JuliusRuppert
Copy link

Describe the bug
When selecting a nested TreeItem via the select method, the tree branch disappears in the list.
This only happens if the tree was not collapsed before. If the tree was collapsed before, it works like expected.

To Reproduce
Steps to reproduce the behavior:

  1. Run code below
  2. Click on one of the Buttons to open a part of the Tree
  3. A part of the Tree will disappear

Expected behavior
Independent if the tree was opened before, the select call should collapse the tree up to the item.

Using select when the tree was not collapsed before
Image

Using select when the tree was collapsed before
Image

Additional context

    TreeItem<String> folderA1_3 = TreeItem.create("File A1-3");
    TreeItem<String> folderA1 = TreeItem.create("Folder A1");
    Tree<String> tree =
            Tree.<String>create("FILES")
                    .setAutoCollapse(false)
                    .setFoldable(true)
                    .setSearchable(true)
                    .setTreeItemIconSupplier(
                            (item) ->
                                    TreeItemIcon.of(
                                            Icons.folder(),
                                            Icons.folder_open(),
                                            Icons.file(),
                                            Icons.file_check_outline()))
                    .appendChild(
                            TreeItem.create("Folder A")
                                    .appendChild(
                                            folderA1
                                                    .appendChild(TreeItem.create("File A1-1"))
                                                    .appendChild(TreeItem.create("File A1-2"))
                                                    .appendChild(folderA1_3)
                                                    .appendChild(TreeItem.create("File A1-3")))
                                    .appendChild(
                                            TreeItem.create("Folder A2")
                                                    .appendChild(TreeItem.create("File A2-1"))
                                                    .appendChild(TreeItem.create("File A2-2"))
                                                    .appendChild(TreeItem.create("File A2-3"))
                                                    .appendChild(TreeItem.create("File A2-4"))))
                    .appendChild(
                            TreeItem.create("Folder B")
                                    .appendChild(
                                            TreeItem.create("Folder B1")
                                                    .appendChild(TreeItem.create("File B1-1"))
                                                    .appendChild(TreeItem.create("File B1-2"))
                                                    .appendChild(TreeItem.create("File B1-3"))
                                                    .appendChild(TreeItem.create("File B1-4")))
                                    .appendChild(
                                            TreeItem.create("Folder B2")
                                                    .appendChild(TreeItem.create("File B2-1"))
                                                    .appendChild(TreeItem.create("File B2-2"))
                                                    .appendChild(TreeItem.create("File B2-3"))
                                                    .appendChild(TreeItem.create("File B2-4")))
                    );

    @Override
    public void onModuleLoad() {

        Button selectTreeItem = Button.create(Icons.tree(),"select " + folderA1_3.getTitle())
                .addClickListener(evt -> folderA1_3.select());
        Button selectTreeIFolder = Button.create(Icons.tree(),"select " + folderA1.getTitle())
                .addClickListener(evt -> folderA1.select());

        AppLayout layout = AppLayout.create("").show();
        layout.withContent((parent, element) -> {
            Row row = Row.create();
            row.appendChild(Column.span1().appendChild(selectTreeItem));
            row.appendChild(Column.span1().appendChild(selectTreeIFolder));
            row.appendChild(Column.span10().appendChild(tree));
            element.appendChild(row);
            body().appendChild(layout);
        });

    }
@vegegoku vegegoku self-assigned this Jan 26, 2025
@vegegoku vegegoku added the bug Something isn't working label Jan 26, 2025
@github-project-automation github-project-automation bot moved this to To do in Domino UI Jan 26, 2025
@vegegoku vegegoku added this to the 2.0.4 milestone Jan 26, 2025
vegegoku added a commit that referenced this issue Jan 28, 2025
@github-project-automation github-project-automation bot moved this from To do to Done in Domino UI Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants