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

Is there an equivalent to GridView's "No records available."

1 Answer 55 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 23 Sep 2019, 05:10 PM

When there is no data for a GridView, a message reading "No records available." appears as the only row in the grid view and I need to show something similar for TreeView.

I can add an arbitrary element to the tree with the display name of "No records available." when there aren't any records but is there a cleaner way do do that through the TreeView API?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 25 Sep 2019, 08:44 AM

Hello Ed,

There is no built-in "no data" template for the TreeView, as the component is empty (and if no custom styling is applied - invisible) when there is no data in the collection it is bound to.

The most straight-forward approach for displaying an indicator that there is no data in the TreeView is to conditionally display a custom (e.g. - DIV) element with the desired text via *ngIf when the data set is empty, for example:

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

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TreeView
Asked by
Ed
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Share this question
or