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

Inline Editable in Parent-Child Grid Row

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shyam
Top achievements
Rank 1
Shyam asked on 02 May 2019, 01:53 PM

I have Parent-Child Grid and I need to provide in-line editable feature in parent row in a particular cell. I have tried GridEditMode.InLine editable but it didn't allow to display the grid value. Please help me to find out the problem area below is my code in View:

 

@model IEnumerable<StarTrax.Mvc.Models.ToFindListViewModel>
@{
    ViewData["Title"] = "View";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@(Html.Kendo().Grid(Model)
                    .Name("grid")
                    .Columns(columns =>
                    {
                        columns.Bound(e => e.Name).Width(110).Title("List Name");
                        columns.Bound(e => e.CreatedAt).Width(110).Title("Create Date").Format("{0:MM/dd/yyyy}");
                        columns.Bound("").Width(110).Title("Created By");
                        columns.Command(command =>
                        {
                            command.Edit();
                            command.Destroy();
                        }).Width(120);
                    })
                    .Editable(editable => editable.Mode(GridEditMode.InLine))
                    .Sortable()
                    .Pageable()
                    .Scrollable()
                    .ClientDetailTemplateId("template")
                    .HtmlAttributes(new { style = "height:430px;" })
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .PageSize(10)
                        .Model(model => model.Id(p => p.EntityId))
                        .Read(read => read.Action("GetAll", "ToFindList"))
                        .Update(update => update.Action("Edit", "ToFindList"))
                        .Destroy(destroy => destroy.Action("Delete", "ToFindList"))
                    )
                    .Events(events => events.DataBound("dataBound"))
)

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().Grid< StarTrax.Mvc.Models.AssetToFindViewModel> ()
                    .Name("grid_#=EntityId#")
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.Asset.EPC.BarCode).Width(110).Title("Barcode");
                        columns.Bound(o => o.Asset.SerialNumber).Width(110).Title("Serial Number");
                        columns.Bound(o => o.Asset.Name).Width(200).Title("Asset Name");
                        columns.Bound(o => o.Asset.Status).Width(200);
                    })
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .PageSize(10)
                        .Read(read => read.Action("GetToFindAssets", "ToFindList", new { toFindListId = "#=EntityId#" }))
                    )
                    .Pageable()
                    .Sortable()
                    .ToClientTemplate()
    )
</script>
<script>function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }</script>

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 07 May 2019, 10:21 AM
Hello Shyam,

Could you please provide us with a little more detailed information about the behavior that you are observing? What do you mean by `it didn't allow to display the grid value`? Does that mean that the grid does not enter mode? Or the editor is not bound to the model?


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Shyam
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or