Selected Item in Dropdown list of ClientDetailTemplate Kendo UI Grid changes only in Edit mode but the selected value does not retain in the read mode..
Below is the code for the grid which uses ClientDetailTemplate that contains another grid with editable dropdown list column.The issue I am facing is the the dropdown list in the second grid doesn't reflect the selected value after selection is made in the edit mode..
Not sure how to make the dropdownlist work correctly when added inside a grid under clientDetailTemplate..
@{Html.Kendo().Grid(Model.lst)
.TableHtmlAttributes(new { Class = "someBoldClass" })
.Name("grd1")
.Columns(columns =>
{
columns.Template(e => { }).ClientTemplate(" ").Title("Phase").Width(85);
columns.Template(e => { }).ClientTemplate(" ").Title("Methodology").Width(110);
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Events(e => e
.DataBound("db")
)
.HtmlAttributes(new { style = "height:350px;width:100%;" })
.ClientDetailTemplateId("ActivitiesTemplate")
.Selectable(select => select.Enabled(true).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
.DataSource(datasource => datasource
.Ajax()
.Model(model =>
{
model.Id(p => p.EmpID);
model.Field(p => p.Name).Editable(false);
}
)
.PageSize(5)
.Read(read => read.Action("PersonContractor_Read", "AUMgr"))
.Model(model => model.Id(p => p.EmpID)))
.Pageable(p => p.Enabled(true))
.Filterable()
.Sortable()
.Scrollable()
.Navigatable()
.Render()
;
}
<script id="ActivitiesTemplate" type="text/kendo-tmpl">
@(Html.Kendo().Grid<RMMockup.Models.Project>()
.Name("GridDetails" + "#=UniqueId#")
.Columns(columns =>
{
columns.Bound(p => p.Phase).ClientTemplate("<div>#=Phase.PhaseName#</div>").Width(95);
columns.Bound(p => p.Methodology).ClientTemplate("#=Methodology.MethodologyName#").Width(110);
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Sortable()
.Selectable(select => select.Enabled(true).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
.HtmlAttributes(new { style = "height:100%;width:100%;" })
.Scrollable(scroll => scroll.Enabled(true))
.Filterable()
.Events(e => e.DataBound("dbActivities"))
.Pageable(page => page.Enabled(false))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetActivities", "AUMgr", new { ProjectID = "#=ProjectID#", PersonId = "#=EmpID#" }).Type(HttpVerbs.Post))
.Model(model =>
{
model.Id(p => p.ProjectID);
model.Field(p => p.Phase).DefaultValue(ViewData["phase"] as RMMockup.Models.Phase);
model.Field(p => p.Methodology).DefaultValue(ViewData["methodology"] as RMMockup.Models.Methodology);
})
)
.ToClientTemplate()
)
</script>
Below is the code for the grid which uses ClientDetailTemplate that contains another grid with editable dropdown list column.The issue I am facing is the the dropdown list in the second grid doesn't reflect the selected value after selection is made in the edit mode..
Not sure how to make the dropdownlist work correctly when added inside a grid under clientDetailTemplate..
@{Html.Kendo().Grid(Model.lst)
.TableHtmlAttributes(new { Class = "someBoldClass" })
.Name("grd1")
.Columns(columns =>
{
columns.Template(e => { }).ClientTemplate(" ").Title("Phase").Width(85);
columns.Template(e => { }).ClientTemplate(" ").Title("Methodology").Width(110);
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Events(e => e
.DataBound("db")
)
.HtmlAttributes(new { style = "height:350px;width:100%;" })
.ClientDetailTemplateId("ActivitiesTemplate")
.Selectable(select => select.Enabled(true).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
.DataSource(datasource => datasource
.Ajax()
.Model(model =>
{
model.Id(p => p.EmpID);
model.Field(p => p.Name).Editable(false);
}
)
.PageSize(5)
.Read(read => read.Action("PersonContractor_Read", "AUMgr"))
.Model(model => model.Id(p => p.EmpID)))
.Pageable(p => p.Enabled(true))
.Filterable()
.Sortable()
.Scrollable()
.Navigatable()
.Render()
;
}
<script id="ActivitiesTemplate" type="text/kendo-tmpl">
@(Html.Kendo().Grid<RMMockup.Models.Project>()
.Name("GridDetails" + "#=UniqueId#")
.Columns(columns =>
{
columns.Bound(p => p.Phase).ClientTemplate("<div>#=Phase.PhaseName#</div>").Width(95);
columns.Bound(p => p.Methodology).ClientTemplate("#=Methodology.MethodologyName#").Width(110);
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Sortable()
.Selectable(select => select.Enabled(true).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
.HtmlAttributes(new { style = "height:100%;width:100%;" })
.Scrollable(scroll => scroll.Enabled(true))
.Filterable()
.Events(e => e.DataBound("dbActivities"))
.Pageable(page => page.Enabled(false))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetActivities", "AUMgr", new { ProjectID = "#=ProjectID#", PersonId = "#=EmpID#" }).Type(HttpVerbs.Post))
.Model(model =>
{
model.Id(p => p.ProjectID);
model.Field(p => p.Phase).DefaultValue(ViewData["phase"] as RMMockup.Models.Phase);
model.Field(p => p.Methodology).DefaultValue(ViewData["methodology"] as RMMockup.Models.Methodology);
})
)
.ToClientTemplate()
)
</script>