TreeView (kendo ui for react)-expand all nodes by default

1 Answer 217 Views
TreeView
A
Top achievements
Rank 1
Iron
Iron
A asked on 07 Feb 2023, 09:30 AM | edited on 07 Feb 2023, 09:39 AM

Hi,

can anyone help with this problem?

https://www.telerik.com/kendo-react-ui/components/treeview/expansion/expanding-all/

 

I need to expand all items by default  in treeview, but it does not work for nested hierarchy. I tried this example, but it does not work for nested json.

For example if i have sometnig like this, it does not show element 'a'?

const tree = [{
  text: 'Item1',
  items: [{
    text: 'Item1.1'
  }, {
    text: 'Item1.2',
    items:[{text:'Item a'}]
  }]
}, {
  text: 'Item2',
  items: [{
    text: 'Item2.1'
  }, {
    text: 'Item2.2'
  }]
}];

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 08 Feb 2023, 10:46 PM

Hello,

You can expand/collapse recursively  all nested nodes by using the `mapTree()` method available in the `@progress/kendo-react-treelist` package:

For convenience I have modified the provided example so you can test the suggested approach directly:

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TreeView
Asked by
A
Top achievements
Rank 1
Iron
Iron
Answers by
Vessy
Telerik team
Share this question
or