or
@(Html.Kendo().Grid<
LexViewModel
>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.LEXId).Hidden(true);
columns.Bound(p => p.LEXName).Title("Name");
columns.Bound(p => p.LEXDescription).Title("Description");
columns.Bound(p => p.ComponentName1).Title("Comp1");
columns.Bound(p => p.ProximityTranche1).Title("Tranche 1");
columns.Bound(p => p.ComponentName2).Title("Comp2");
columns.Bound(p => p.ProximityTranche2).Title("Tranche 2");
columns.Bound(p => p.ComponentName3).Title("Comp3");
columns.Bound(p => p.ProximityTranche3).Title("Tranche 3");
columns.Bound(p => p.ComponentName4).Title("Comp4");
columns.Bound(p => p.LEXId).ClientTemplate("myDropDownCustomTemplate");
columns.Bound(p => p.IsActive);
columns.Command(cmd => cmd.Edit()).Title("Update");
})
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Model(m =>
{
m.Id(p => p.LEXId);
m.Field(p => p.LEXId).Editable(false);
m.Field(p => p.LEXName);
m.Field(p => p.LEXDescription);
m.Field(p => p.AllComponents);
m.Field(p => p.IsActive);
})
.Read(read => read.Action("Read", "Home"))
.Update(update => update.Action("EditingCustom_LexUpdate", "Home"))
)
.Pageable()
.Sortable()
.Editable(ed => ed.Mode(GridEditMode.InLine))
.Filterable()
.Groupable()
)
<
script
id
=
"myDropDownCustomTemplate"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().DropDownList()
.Name("ReuseableComponents")
.SelectedIndex(0)
.Items(items =>
{
//Call Controller and Popuplate Dropdown
// Based on LEXId
})
.ToClientTemplate()
)
</
script
>
@(
Html.Kendo().TreeView()
.Name(
"treeView"
)
.BindTo(Model, mapping =>
mapping.For<SomeViewModel>(binding =>
binding.ItemDataBound((item, viewModel) =>
{
item.Text = viewModel.DisplayName;
})
.Children(viewModel => viewModel.Children)))
.TemplateId(
"some-template"
)
)
columns.Bound(e => e.Name).Filterable(true);
.Columns(columns =>
{
columns.Bound(p => p.LEXId).Hidden(true);
columns.Bound(p => p.LEXName).Title("Name");
columns.Bound(p => p.LEXDescription).Title("Description");
columns.Bound(p => p.AllTranches).ClientTemplate("#= tranchesTemplate(data) #"); //edit these cells in a popup
columns.Bound(p => p.ComponentName1).Title("Comp1");
columns.Bound(p => p.ProximityTranche1).Title("Proximity");
columns.Bound(p => p.ComponentName2).Title("Comp2");
columns.Bound(p => p.ProximityTranche2).Title("Proximity");
columns.Bound(p => p.IsActive);
columns.Command(cmd => cmd.Edit()).Title("Update");
})
<script type=
"text/javascript"
>
function
tranchesTemplate(item) {
var
html =
"<table>"
;
for
(
var
i = 0; i < item.AllTranches.length; i++) {
if
(item.AllTranches[i]) {
if
((i % 3 == 0) || (i == 0)) {
html +=
"<tr>"
;
html +=
"<td>"
;
html += item.AllTranches[i];
html +=
"</td>"
;
}
else
{
html +=
"<td>"
;
html += item.AllTranches[i];
html +=
"</td>"
;
}
}
}
html +=
"</tr>"
;
html +=
"</table>"
;
html +=
"<table>"
;
html +=
"<tr>"
;
html +=
"<td><a class=k-button tranche-edit>Edit</a></td>"
;
html +=
"</tr>"
;
html +=
"</table>"
;
return
html;
}
</script>