Blazorise icon indicating copy to clipboard operation
Blazorise copied to clipboard

Improvements on TreeView

Open stsrki opened this issue 5 years ago • 11 comments

Features for next version of TreeView

  • [ ] Validation support
  • [ ] Editing of node
  • [ ] EditTemplate for custom editing
  • [ ] Expand/Collapse doesn't work on mobile(see comment bellow)

@robalexclark

stsrki avatar Jun 18 '20 11:06 stsrki

It would be nice to have a way to customise the icons for opening and closing a node. For example, I would like to replace the plus and minus icons for a right and down arrow.

FrancisValade avatar Sep 04 '20 18:09 FrancisValade

@stsrki Not sure if it's the right place to ask/suggest.

It's rather hard to expand and collapse TreeView nodes on mobile phone. It works 50/50, I'd say. Maybe the suggested above custom (larger) icons may help, if implemented.

nightroman avatar May 30 '21 19:05 nightroman

I just tested on mobile. You're right, something is wrong with click or tap events. I need to "click" several times to make it expand or collapse. Weird...

stsrki avatar May 31 '21 07:05 stsrki

If this needs a separate issue please let me know.

nightroman avatar May 31 '21 07:05 nightroman

No need, I have updated the original ticket with new item.

stsrki avatar May 31 '21 07:05 stsrki

One more minor defect (?) - on hovering over expand/collapse icons the mouse pointer does not change from the "arrow" to "hand" (click me convention).

nightroman avatar Jun 02 '21 00:06 nightroman

Is there a way to expand all Nodes by default on page load?

CMontani89 avatar Nov 30 '21 16:11 CMontani89

To expand all nodes I would loop through and add all nodes to an IList<T> expandedNodes and then set that to @bind-expandednodes e.g.

<TreeView Nodes="holdings"
                            @bind-SelectedNode="selectedNode"
                            @bind-ExpandedNodes="expandedNodes"
                            GetChildNodes="@(item => item.Children)"
                            HasChildNodes="@(item => item.Children?.Any() == true)">
                      <NodeContent>
                          @if (context.HoldingType == "Holding Unit")
                          {
                              <Icon Name="IconName.Building" />
                          }
                          else if (context.HoldingType == "Room")
                          {
                              <Icon Name="@("fa-door-closed")" />
                          }
                          else if (context.HoldingType == "Cage")
                          {
                              <Icon Name="@("fa-th")" />
                          }

                          @context.Text
                      </NodeContent>
                  </TreeView>

robalexclark avatar Nov 30 '21 17:11 robalexclark

It would be nice to have a way to customise the icons for opening and closing a node. For example, I would like to replace the plus and minus icons for a right and down arrow.

Any progress on this?

I would like to at least vertically align the + and - icons when using a custom razor component for the tree node.

tree

Jinjinov avatar May 15 '22 11:05 Jinjinov

We don't have any milestones still. But, PRs are welcome :)

stsrki avatar May 16 '22 09:05 stsrki

I added customizable icon for collapse/ expand icon. pull request

solalem avatar May 24 '22 07:05 solalem