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

Question: Is there a way to deactivate "toggleExpansion" ? #20

Open
DasTobbel opened this issue Jul 11, 2023 · 2 comments
Open

Question: Is there a way to deactivate "toggleExpansion" ? #20

DasTobbel opened this issue Jul 11, 2023 · 2 comments
Labels
wontfix This will not be worked on

Comments

@DasTobbel
Copy link

Hi,
i'm looking for a way to, based on the item, to deactivate the expansion/collapse of its children.
Is there a way currently ?

Or is it something you want to achieve?
If yes, my suggestion would be something like, i could do the PR:

  Future<void> toggleExpansion(ITreeNode<Data> item) async {
    if (item.isExpandable == false) {
      return;
    }
    if (item.isExpanded)
      await collapseNode(item);
    else {
      expandNode(item);
      await applyExpansionBehavior(item);
    }
  }

Greets!

@jawwad-hassan89
Copy link
Collaborator

Logically speaking, if a node has children then it should be expandable, otherwise, it shouldn't have any children. So, I would rather not have this functionality, but you are free to create your own fork for this change set.

@DasTobbel
Copy link
Author

Ah, let me rephrase it:
I want to forbid the collapsing of node+children as i click on the node.

Currently if i use the treeview and the node has children, the "onItemTap" function will collapse/expand the clicked node while executing the "onItemTap" function.

Probably something like this, while adding the default "node.mayCollapse = true"?

  Future<void> toggleExpansion(ITreeNode<Data> item) async {
   if (item.isExpanded && item.children.isNotEmpty && item.mayCollapse == false) {
      return;
    }
    else if (item.isExpanded &&  item.mayCollapse)
      await collapseNode(item);
    else {
      expandNode(item);
      await applyExpansionBehavior(item);
    }
  }

@jawwad-hassan89 jawwad-hassan89 added the wontfix This will not be worked on label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants