I am having an issue with the template system
my datasource is volatile by design to allow for maximum flexibility. Everything works great except I have one problem. If an item is undefined it ceases to render any other items if a template is applied. I will use a grid object to explain.
Incoming Data
If the template is not set it works as expected non existing members are not shown and everything is hunky dory. But with the template an error gets thrown when it can find BirthDate and stops rendering the grid.
I've tried doing an if statement in the template to return null if the object is undefined but that didn't seem to make a difference.
Any thoughts on possible workarounds?
my datasource is volatile by design to allow for maximum flexibility. Everything works great except I have one problem. If an item is undefined it ceases to render any other items if a template is applied. I will use a grid object to explain.
$("#grid").kendoGrid({
dataSource: dataSource,
groupable: true,
sortable: true,
pageable: {
pageSizes: true
},
columns: [{
field: "FirstName",
title: "First Name"
}
,
{
field: "LastName",
title: "Last Name"
}
,
{
field: "City"
}
,
{
field: "Title"
}
,
{
field: "BirthDate",
title: "Birth Date",
template: '#: FormatDate(BirthDate,"dd MMMM yyyy") #'
}
,
{
field: "Age"
}
]
});
Incoming Data
[
{"FirstName":"John","LastName":"Smith","City":"Smalltown","Title":"AR","BirthDate":"1984-07-16T05:00:00Z","Age":28},
{"FirstName":"John","LastName":"Smith","City":"Smalltown","Title":"AR","BirthDate":"1984-07-16T05:00:00Z"},
{"FirstName":"John","LastName":"Smith","City":"Smalltown","Title":"AR"}
]
If the template is not set it works as expected non existing members are not shown and everything is hunky dory. But with the template an error gets thrown when it can find BirthDate and stops rendering the grid.
ReferenceError: BirthDate is not defined
kendo.all.js Line 281 : return new Function(argumentName, functionBody);
I've tried doing an if statement in the template to return null if the object is undefined but that didn't seem to make a difference.
Any thoughts on possible workarounds?