You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/panelbar/data-binding/overview.md
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ Each `PanelBarBinding` tag exposes the following properties that refer to item p
66
66
67
67
* ItemsField => Items
68
68
69
-
* Level - this is used for defining [different bindings for different levels](#multiple-level-bindings). If no level is set, the bindings are taken as default for any level that does not have explicit settings. You should have one `TelerikPanelBarBinding` without a level.
69
+
* Level—this is used for defining [custom field bindings](#custom-field-bindings) or [different bindings for different levels](#multiple-level-bindings). If no level is set, the bindings are taken as default for any level that does not have explicit settings. You must have one `TelerikPanelBarBinding` without a level to set the default bindings.
70
70
71
71
>tip There are default values for the field names. If your model names match the defaults, you don't have to define them in the bindings settings.
72
72
@@ -182,6 +182,15 @@ The following **Example** shows how to define simple binding to match item field
182
182
183
183

184
184
185
+
### Custom Field Bindings
186
+
187
+
If you are using custom field names, you must ensure their binding for each level. Otherwise, the PanelBar will not render items where the field bindings are missing.
188
+
189
+
For that purpose, you must do either of the following:
190
+
191
+
* Add one `TelerikPanelBarBinding` without a level to set the default bindings.
192
+
* Add `TelerikPanelBarBinding` for each level where you explicitly set the field bindings to your custom fields.
193
+
185
194
### Multiple Level Bindings
186
195
187
196
You can define different binding settings for the different levels of nodes in the PanelBar. With this, the children of a node can consume a different field than their parent, and this may make your application more flexible. If you use [hierarchical data binding](slug:panelbar-data-binding-hierarchical), the children can even use a different field or model from their parent.
Copy file name to clipboardExpand all lines: components/panelbar/templates/header.md
+42-41Lines changed: 42 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,9 @@ position: 5
13
13
14
14
You can control and customize the rendering of the header items in the PanelBar by using the `HeaderTemplate`. It provides a `context` object that you can cast to the type that the PanelBar is bound to.
15
15
16
-
The `HeaderTemplate` of a level is defined under the `PanelBarBinding` tag.
16
+
The `HeaderTemplate` of a level is defined under the `PanelBarBinding` tag. Set the `Level` parameter of the `PanelBarBinding` to specify the level the `HeaderTemplate` must be applied to.
17
17
18
-
If no levels are defined the `HeaderTemplate` will apply to the entire data.
18
+
If the `Level` parameter of the `PanelBarBinding` is not set, the `HeaderTemplate` will apply to the entire data.
19
19
20
20
>caption Use HeaderTemplate to customize the rendering of the headers in the PanelBar
21
21
@@ -26,7 +26,7 @@ If no levels are defined the `HeaderTemplate` will apply to the entire data.
26
26
<TelerikPanelBar Data="@Items"
27
27
@bind-ExpandedItems="@ExpandedItems">
28
28
<PanelBarBindings>
29
-
<PanelBarBinding>
29
+
<PanelBarBinding Level="0">
30
30
<HeaderTemplate>
31
31
@{
32
32
var item = context as PanelBarItem;
@@ -42,8 +42,9 @@ If no levels are defined the `HeaderTemplate` will apply to the entire data.
42
42
</div>
43
43
44
44
@code {
45
-
public List<PanelBarItem> Items { get; set; }
46
-
public IEnumerable<object> ExpandedItems { get; set; } = new List<object>();
45
+
private List<PanelBarItem> Items { get; set; }
46
+
47
+
private IEnumerable<object> ExpandedItems { get; set; } = new List<object>();
47
48
48
49
public class PanelBarItem
49
50
{
@@ -60,50 +61,50 @@ If no levels are defined the `HeaderTemplate` will apply to the entire data.
60
61
List<PanelBarItem> items = new List<PanelBarItem>();
0 commit comments