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

Treeview loading indicator

3 Answers 21 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Veteran
Iron
Michael asked on 28 Jan 2021, 03:40 PM

Hi!

Is it possible to show the small busy indicator from the Treeview when its programmatically expanded like in the following example when double clicked the item

https://stackblitz.com/edit/angular-6n5745?file=app/app.component.ts

3 Answers, 1 is accepted

Sort by
0
Accepted
Missing User
answered on 01 Feb 2021, 06:46 AM

Hello Michael,

Thank you for the provided example. The loading indicator can be triggered when expanding a node by calling the TreeView expandNode method. What it does internally is that it emits an expand event for the targeted node as if it were triggered by user interaction. Thus the loading indicator is also activated. Here's an example. Notice that I also pass the node index as well - this is required for the loading indicator to kick in.

Also, you can avoid defining a node template just to capture the dblclick event - the TreeView exposes a nodeDblClick event which can be used instead to caputre the event more easily. Here's an updated example.

Let me know if you need further assistance on the topic.

Regards,
Dimitar
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/.

0
Michael
Top achievements
Rank 1
Veteran
Iron
answered on 02 Feb 2021, 06:39 PM

Hi Dimitar,

thx for the reply and the hint with the (nodeDblClick) event - works great.

 

One more question: is there a way to cache loaded tree items?

0
Missing User
answered on 03 Feb 2021, 05:59 AM

Hi Michael,

The TreeView currently doesn't support children caching. Each expand/collapse/expand iteration will trigger the provided children callback for the expanded node.

It can be handled in your code though. The service can be configured to store child nodes when loaded on demand and retrieve the cache when requested again. Here's an example for this. Notice that the app.component is not changed at all - only the service is modified to persist the items once loaded.

As a side note, I'd ask you to open new tickets or forum threads in the future, when you have a question unrelated to the original one. The idea is to keep clean threads where a single problem is resolved. It's much easier to get around for both us and potentially even you. Thanks in advance!

Regards,
Dimitar
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
Michael
Top achievements
Rank 1
Veteran
Iron
Answers by
Missing User
Michael
Top achievements
Rank 1
Veteran
Iron
Share this question
or