This is a migrated thread and some comments may be shown as answers.

Selected Item in Dropdown list of ClientDetailTemplate Kendo UI Grid does not change

1 Answer 162 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chandran
Top achievements
Rank 1
chandran asked on 29 Jan 2014, 06:57 PM
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>

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 31 Jan 2014, 01:08 PM
Hi Chandran,

I would suggest to check the following demo which demonstrates how to correctly implement the Ajax Hierarchy editing using KendoUI Grid:
Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
chandran
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or