New to Telerik UI for Blazor? Download Free 30-day trial
Menu - Flat Data
- EXAMPLE
- VIEW SOURCE
- EDIT IN TELERIK REPL
- Change Theme
default
- Flat-data.razor
Description
The Telerik UI for Blazor Menu displays data in a traditional menu-like structure. It allows you browse through the items and their children, and supports data binding to hierarchical data or flat data.
The component rendering will be the same regardless of the data type, however, its configuration will be different when using flat or hierarchical data. The current demo targes data binding to flat data.
While in the hierarchical data collections the model of the parent item contains a list of its children, in the flat data collections all records are available at one level. The parent-child relationships are created through internal data in the model. You can use the default data binding in your model, so the Menu will automatically recognize the properties and create the relations. The default ParentId
field points to the default Id
of the item that will contain the current item. The root level item has null for ParentId
.
In case you are using custom property names, you should point the ParentIdField
and IdField
properties of the Menu to the corresponding fields of your model.
The demo above demonstrates a Telerik Blazor Menu component that uses flat data. The parent-child relationship is created through the SectionId
and Id
fields of the MenuItem model
.