Can't get incell editing to work in kendo grid

2 posts, 0 answers
  1. Colin
    Colin avatar
    5 posts
    Member since:
    Mar 2013

    Posted 05 Sep 2013 Link to this post

    Hello,

    I am trying to create a simple grid where I allow incell editing and each time a cell edits it sends that row back to the server with an ajax call, but I can't seem to get inline editing to work.  here is what I have so far...

    01.@using Kendo.Mvc.UI
    02.@model IEnumerable<Forms.Models.Pending>
    03. 
    04. 
    05.@{
    06.    Layout = "~/Views/Shared/_Layout.cshtml";  
    07.}
    08. 
    09.<h2>Pending</h2>
    10. 
    11.@(Html.Kendo().Grid(Model)
    12.    .Name("Grid")
    13.    .Columns(columns =>
    14.        {
    15.            columns.Bound(p => p.Name).Groupable(false);
    16.            columns.Bound(p => p.Number);
    18.            columns.Bound(p => p.Status);
    21.            columns.Bound(p => p.Analyst);
    22.        })
    23.        .Editable(editable => editable.Mode(GridEditMode.InCell))
    24.        .Pageable()
    25.        .Sortable()
    26.        .DataSource(dataSource => dataSource
    27.            .Ajax()
    28.            .Model(model => model.Id(p => p.Id))
    29.            .Read("Index", "Home")
    30.            .Update("Row_Edit", "Home")
    31.        )
    32.)
    I am trying to use the .Update property to call the Row_Edit method in my home controller to handle each edit.  Any ideas?
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2272 posts

    Posted 06 Sep 2013 Link to this post

    Hi Colin,


    The provided sample code seems correct (assuming that the saveChanges functionality is implemented separately). Could you please check if there are any JavaScript errors in the console and that the requests are sent correctly in the "Network" tab? In the current implementation the dataSource is configured with batch false, which means that a separate request will be send for each updated item and the signature of the Update Action method should be similar to the following one.
    E.g.
    public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, ProductViewModel product)
    { ... }

    Please let me know if this information was helpful for you or I could assist you further? I wish you a great day!

     

    Regards,
    Dimiter Madjarov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top