I bind to list of columns, some of them are complex like "ProfileDetails" property.
If we bind to a complex column like “ProfileDetails.FullAddress” while “ProfileDetails” object is null in received data
we get an exception on JavaScript code and no data appear.
can any one tell me how to fix it
If we bind to a complex column like “ProfileDetails.FullAddress” while “ProfileDetails” object is null in received data
we get an exception on JavaScript code and no data appear.
can any one tell me how to fix it
6 Answers, 1 is accepted
0

ahmed
Top achievements
Rank 1
answered on 05 Mar 2015, 08:40 AM
Here is My Code Demo To Explain my problem :
var list= [{
"EmployeID": "1",
"ProfileDetails":
{
"id": 1,
"FullAddress": "4 u st.,uk"
},
"isAdmin": false}];
var tempSource = new kendo.data.DataSource({
data: list,});
$("#grid").kendoGrid({
dataSource: tempSource,
columns: [{field:"EmployeID",title:"ID"},{field:"ProfileDetails.FullAddress",title:"Address"}],});
var list= [{
"EmployeID": "1",
"ProfileDetails":
{
"id": 1,
"FullAddress": "4 u st.,uk"
},
"isAdmin": false}];
var tempSource = new kendo.data.DataSource({
data: list,});
$("#grid").kendoGrid({
dataSource: tempSource,
columns: [{field:"EmployeID",title:"ID"},{field:"ProfileDetails.FullAddress",title:"Address"}],});
0

ahmed
Top achievements
Rank 1
answered on 05 Mar 2015, 08:42 AM
Here is My Code Demo To Explain my problem :
var list= [{
"EmployeID": "1",
"ProfileDetails":
{
"id": 1,
"FullAddress": "4 u st.,uk"
},
"isAdmin": false},{
"EmployeID": "2",
"ProfileDetails":null,
"isAdmin": true}];
var tempSource = new kendo.data.DataSource({
data: list,});
$("#grid").kendoGrid({
dataSource: tempSource,
columns: [{field:"EmployeID",title:"ID"},{field:"ProfileDetails.FullAddress",title:"Address"}],});
var list= [{
"EmployeID": "1",
"ProfileDetails":
{
"id": 1,
"FullAddress": "4 u st.,uk"
},
"isAdmin": false},{
"EmployeID": "2",
"ProfileDetails":null,
"isAdmin": true}];
var tempSource = new kendo.data.DataSource({
data: list,});
$("#grid").kendoGrid({
dataSource: tempSource,
columns: [{field:"EmployeID",title:"ID"},{field:"ProfileDetails.FullAddress",title:"Address"}],});
0
Hello Ahmend,
You can fix this by defining a safe template because the built-in one that is generated looks like this:
And what you can use is:
Kind Regards,
Petur Subev
Telerik
You can fix this by defining a safe template because the built-in one that is generated looks like this:
template:
"#= complex.foo #"
And what you can use is:
template:
"#= complex && complex.foo #"
Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

ahmed
Top achievements
Rank 1
answered on 08 Mar 2015, 08:26 AM
This fix my problem thank you
0

Jacques
Top achievements
Rank 2
answered on 08 Jun 2015, 02:39 PM
Using a template breaks filtering. You end up with the "".toLowerCase is not a function exception.
Kendo version: 2015.1.408
0
Hello Jacques,
Basically sorting / filtering / grouping of columns that are bound to a complex property from the model is not supported out-of-the-box as the Grid didn't have the information about which of the nested fields should be used for these operations.
If the field configuration is set as
{field:
"ProfileDetails.FullAddress"
,title:
"Address"
}
the filtering will work on the FullAdress value. Regards,
Boyan Dimitrov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!