We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Javascript error when clicking on a cell with DOM layers.

Hi,

I've noticed that I get a type error in Javascript whenever I click a cell which has layers of DOM elements.

I get the following error:
 > Uncaught TypeError: Cannot read property 'field' of undefined
 
The table code is as follows:

@( Html.EJ().Grid<DisplayController.Person>("FlatGrid")
  .Datasource((IEnumerable<object>)ViewBag.datasource)
  .AllowSorting()
  .AllowPaging(true)
  .PageSettings(p => p.PageSize(2))
  .Columns(c =>
  {
  c.Field("FirstName").HeaderText("First Name").Width(150).Add();
  c.Field("LastName").HeaderText("Last Name").Width(150).Template(true).TemplateID("#person-template").Add();
  c.Field("Email").HeaderText("Email").Width(150).Add();
  })
  .DetailsTemplate("#person-detail")
)

<script id="person-template" type="text/template">
<div class="person-content">
<div style="width: 3em; background-color: red; display: inline-block;">:)</div>
<div style="display: inline-block;">{{:LastName}}</div>
</div>
</script>


<script id="person-detail" type="text/template">
<div class="expanded-content">
<div><label style="margin-right: 2em;">Middle name</label><span>{{:MiddleName}}</span></div>
<div><label style="margin-right: 2em;">Pet</label><span>{{:Pet}}</span></div>
</div>
</script>

I get the javascript error when I click on cells in the 'Last name' column. When I simplify the contents of the template to the following, I do not get the error.
<script id="person-template" type="text/template">
<div class="person-content">
{{:LastName}}
</div>
</script>


1 Reply

RU Ragavee U S Syncfusion Team March 12, 2015 10:26 AM UTC

Hi Rachael,

We considered the requirement “Script error is thrown on clicking template cell” as a bug. We have logged a report on this and will fix the issue internally, also the fix will be included in Vol 1, 2015 service pack 1 release, which has been scheduled to be rolled out in the month of April 2015.

We have also created an incident internally to have a follow up with this issue.

Please let us know if you have any queries.

Regards,

Ragavee



Loader.
Up arrow icon