Skip to content

Commit 2a9c783

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent aa0ecc2 commit 2a9c783

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: Use Nested Model Properties
3+
page_title: Use Nested Model Properties | {{ site.framework }}
4+
description: An example on how to use nested model properties in the {{ site.framework }}
5+
slug: howto_use_nested_model_properties_grid
6+
tags: use, nested, model, properties, grid
7+
component: grid
8+
type: how-to
9+
res_type: kb
10+
---
11+
12+
## Environment
13+
14+
<table>
15+
<tr>
16+
<td>Product</td>
17+
<td>{{ site.framework }} Grid</td>
18+
</tr>
19+
<tr>
20+
<td>Operating System</td>
21+
<td>All</td>
22+
</tr>
23+
<tr>
24+
<td>Browser</td>
25+
<td>All</td>
26+
</tr>
27+
<tr>
28+
<td>Browser Version</td>
29+
<td>All</td>
30+
</tr>
31+
</table>
32+
33+
## Description
34+
35+
How can I use nested Model properties in the {{ site.framework }}'s Grid?
36+
37+
## Solution
38+
39+
To bind a column of the Grid to a Model with nested properties you need to use a Custom DataSource which allows you to configure the `[From](https://docs.telerik.com/{{ site.platform }}/api/Kendo.Mvc.UI.Fluent/CustomDataSourceModelFieldDescriptorBuilder#fromsystemstring)` configuration property of the `[Schema.Model.Field](https://docs.telerik.com/{{ site.platform }}/api/Kendo.Mvc.UI.Fluent/CustomDataSourceModelDescriptorFactory#fieldsystemstring)`.
40+
41+
In addition when you use `From` together with CRUD operations and add new rows, you also have to define in `Schema.Model.Field` the original field or the sequence of nested fields which are used inside `From`.
42+
43+
The reason is that during updates and creates, the Telerik UI DataSource tries to construct a data item object which matches the original (server-side) data-item structure. For new data items, such a structure does not exist and needs to be defined explicitly.
44+
45+
```
46+
...
47+
.DataSource(ds => ds
48+
.Custom()
49+
.PageSize(20)
50+
.ServerFiltering(false)
51+
.Schema(schema =>
52+
schema.Model(model =>
53+
{
54+
model.Id(id => id.Name);
55+
model.Field(f => f.Name);
56+
model.Field(f => f.Description).From("Description.Text");
57+
}).Data("Data").Total("Total")
58+
)
59+
.Transport(transport =>
60+
{
61+
transport.Read("Orders_Read", "Grid");
62+
transport.Update("Orders_Update", "Grid");
63+
transport.Create("Orders_Create", "Grid");
64+
transport.Destroy("Orders_Destroy", "Grid");
65+
})
66+
)
67+
)
68+
```
69+
70+
## See Also
71+
72+
* [JavaScript API Reference of the Grid](https://docs.telerik.com/kendo-ui/api/javascript/ui/grid)
73+
* [JavaScript API Reference of the DataSource](https://docs.telerik.com/kendo-ui/api/javascript/data/datasource)
74+
* [Server-side API Reference of the DataSource](https://docs.telerik.com/{{ site.platform }}/api/datasource)

styles/web/common/tabstrip.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@
274274
// Disabled
275275
.k-tabstrip .k-button.k-disabled {
276276
pointer-events: none;
277-
opacity: 0;
278277
}
279278

280279

0 commit comments

Comments
 (0)