This is a migrated thread and some comments may be shown as answers.

Grid, after refresh template stops working

1 Answer 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Maikel
Top achievements
Rank 1
Maikel asked on 14 Aug 2014, 08:43 AM
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.

1 Answer, 1 is accepted

Sort by
0
Maikel
Top achievements
Rank 1
answered on 15 Aug 2014, 08:09 AM
I've solved my own question, in my case it is because i used jQuery 1.7.1 and not 1.9.1 (why 1.7.1 is in the telerik package i don't know...) When using jQuery 1.9.1 all works well.
So when you see allot of function undefined and such look at this dependencies:

http://docs.telerik.com/kendo-ui/getting-started/javascript-dependencies#jquery-version

Open one of the kendo scripts to see what version you are using.
Tags
Grid
Asked by
Maikel
Top achievements
Rank 1
Answers by
Maikel
Top achievements
Rank 1
Share this question
or