After i change datasource of my grid i cant use my editortemplate.01.
<%=
02.
Html.Kendo().Grid<
InvoerPortaal.Models.VW_GetAllergenen_Result
>()
03.
.Name("Allergenen")
04.
.Columns(columns =>
05.
{
06.
columns.Bound(p => p.AllergeenNaam);
07.
columns.Bound(p => p.AllergeenType).EditorTemplateName("AllergeenTypeEditor").Title("AllergeenType").ClientTemplate("thisismyclienttemplate");
08.
})
09.
.Editable(editable => editable.Mode(GridEditMode.InCell))
10.
.HtmlAttributes(new { style = "height:430px;" })
11.
.Events(events => events.Change("AllergenenTypeEditor_Change"))
12.
.DataSource(dataSource => dataSource
13.
.Ajax()
14.
.Batch(true)
15.
.ServerOperation(true)
16.
.Read(read => read.Action("Allergenen_Read", "Home", new { ArtikelID = 1}))
17.
.Events(events => events.Error("errorHandler"))
18.
.Model(model =>
19.
{
20.
model.Id(p => p.Allergeen_ID);
21.
model.Field(p => p.AllergeenNaam).Editable(false);
22.
model.Field(p => p.AllergeenType).DefaultValue(1);
23.
})
24.
.Update(update => update.Action("AllergeenType_Update", "Home"))
25.
)
26.
%>
When clicking other grid to get "artikelid" i change datasource.read and then refresh the datasource.
1.
var
grid = $(
"#Artikelen"
).data(
"kendoGrid"
).dataItem(
this
.select());
2.
var
allergenenGrid = jQuery(
"#Allergenen"
).data(
"kendoGrid"
);
3.
allergenenGrid.dataSource.read({ ArtikelID: grid.HBC_ArtikelID });
4.
allergenenGrid.refresh();
5.
$(
'.content-wrapper'
).show();
When I then try to edit the "AllergeenType" with the editortemplate i get the following error:
In chrome: Uncaught TypeError: undefined has no properties
In firefox: can't convert undefined to object
In IE11: (translate from dutch to english) Can't find object template from not defined empty value.(something like that)
As trace error it comes here:
(
function
(data<br>
/**/
) {<br>
var
o,e=kendo.htmlEncode;
with
(data){o=
'thisismyclienttemplate'
;}
return
o;<br>})
where thisismyclienttemplate is the string i filled in my clienttemplate, but i dont really see whats wrong with that, my clienttemplate shows up as it supposed to, but when i click the cell i get that error and my editortemplate doesn't show up.
Hope anyone could help me out.