This is a migrated thread and some comments may be shown as answers.

Treeview Templates

1 Answer 165 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Niklas
Top achievements
Rank 1
Niklas asked on 02 Oct 2019, 01:27 PM

Greetings!

I'm trying to replicate your docs' sidenav with a Treeview component.
I was trying to overwrite the category template via Treeview Templates, but i can only overwrite the item container, not the complete node.
My idea was to overwrite the root category node to alter the expand icon, ... your sidenav opens child nodes with a click on the root node.

Does anybody has an idea? ...

Niklas

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 02 Oct 2019, 02:13 PM

Hi Niklas,

The template of the nodes is for their content so we can provide animations and expand/collapse arrows.

You can have nodes expand and collapse on clicks by hooking your own click handler on the content (inside your template) and toggling the value of the Expanded field of the model.

If you have older versions of our demos from about a month back, you can find a similar approach used there. I'm attaching here the two relevant components that show how we had that done - the template is its own component which bubbles up an event coming from an @onclick attached to a span in the content. The event handler toggles the Expanded field value of the model.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Tags
TreeView
Asked by
Niklas
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or