I have a model with ID and and array of values, I need each of the array value to be displayed in separate column in kendo grid and all this should be editable fields.
public int Id { get; set; }
public double[] List { get; set; }
I have tried the following way however it display all values in one cell.
@model IEnumerable<HoursModel>
<div id="PlanningGrid">
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
//// columns.AutoGenerate(true);
columns.Bound(c => c.Id).HeaderHtmlAttributes(new {@class = "grid-header-cell"}).HtmlAttributes(new {@class = "grid-row-cell planningoverview-grid-cell1"});
columns.Bound(p => p.List).ClientTemplate("#=generateTemplate(HoursList)#");
//// columns.Bound(m => m.EmployeeId).ClientTemplate("# for (var i=0;i<4;increment(i)) { console.log(i) } #");
})
.Sortable())
</div>
<script type="text/javascript">
function generateTemplate(Wetness) {
var template = "<ul>";
for (var i = 0; i < Wetness.length; i++) {
template = template + "<li>" + Wetness[i] + "</li>";
}
return template + "</ul>";
}
</script>
public int Id { get; set; }
public double[] List { get; set; }
I have tried the following way however it display all values in one cell.
@model IEnumerable<HoursModel>
<div id="PlanningGrid">
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
//// columns.AutoGenerate(true);
columns.Bound(c => c.Id).HeaderHtmlAttributes(new {@class = "grid-header-cell"}).HtmlAttributes(new {@class = "grid-row-cell planningoverview-grid-cell1"});
columns.Bound(p => p.List).ClientTemplate("#=generateTemplate(HoursList)#");
//// columns.Bound(m => m.EmployeeId).ClientTemplate("# for (var i=0;i<4;increment(i)) { console.log(i) } #");
})
.Sortable())
</div>
<script type="text/javascript">
function generateTemplate(Wetness) {
var template = "<ul>";
for (var i = 0; i < Wetness.length; i++) {
template = template + "<li>" + Wetness[i] + "</li>";
}
return template + "</ul>";
}
</script>