Hi guys! I really need your help!
It is necessary to make a dynamic grid with the ability to edit cells. The grid layout appears. Column names are visible. Data is not loaded into the grid. There is an error in the browser console:"Uncaught SyntaxError: unexpected token: numeric literal" kendo.all.js:63353:40. I can’t cope with this error ...
View:
@model System.Data.DataTable@{ var id = Model.Columns[0].ColumnName; var templateName = "String";}@(Html.Kendo().Grid<dynamic>() .Name("Grid") .Columns(columns => { foreach (System.Data.DataColumn column in Model.Columns) { switch (column.DataType.ToString()) { case "System.Int16": case "System.Int32": case "System.Int64": templateName = "Integer"; break; case "System.Decimal": case "System.Double": case "System.Float": templateName = "Number"; break; case "System.String": templateName = "NotEditable"; break; } if (column.ColumnName == id) { templateName = "NotEditable"; } columns.Bound(column.ColumnName).Title(column.Caption).EditorTemplateName(templateName).EditorViewData(new { name = id }); } }) .ToolBar(toolbar => {toolbar.Save(); }) .Editable(ed=>ed.Mode(GridEditMode.InCell)) .Scrollable() .DataSource(dataSource => dataSource.Ajax() .Batch(true) .Model(model => { model.Id(id); foreach (System.Data.DataColumn column in Model.Columns) { var field = model.Field(column.ColumnName, column.DataType); if (column.ColumnName == id || column.ColumnName == "BusName") { field.Editable(false); } } }) .Read("Read", "Project") .Update("Update", "Project") ) )Controller:
public ActionResult Index() { DataTable proj = new DataTable("table"); proj.Columns.Add()...; proj.Rows.Add() return View(proj); }In debug mode, the Read method does not enter ...
kendo ver. 2018.1.221.545
Please tell me what to do. 2 days I can not solve this problem