New Entry / Grouping behavior when using a Pop-up Editor

4 posts, 0 answers
  1. Richard
    Richard avatar
    10 posts
    Member since:
    Aug 2013

    Posted 04 Nov 2013 Link to this post

    I have a group-able Kendo grid with a pop-up editor. When the user clicks "New Entry" a new row is created in a new grouping even if the a group already exists for that value. Additionally, if the user clicks "Cancel" the incomplete row and its group is retained. If the user clicks "New Entry" again, the old incomplete entry is removed, but the group is retained.

    How do I tell the Kendo Grid to not create a new row until the user has clicked OK for the new entry (and the entry has passed validation)? Is it possible to have this new row correctly placed in the appropriate grouping?

    Thanks!
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 06 Nov 2013 Link to this post

    Hello Richard,

    Creating a new group when adding new item is expected, unless there is a defaultValue for the column which the Grid is grouped by. Here I tried to reproduce the issue, but everything works as expected - both the new row and the new group are removed on Cancel. Could you please check the example and let me know if I am doing something differently? 
    I am afraid that adding the new row only after pressing the OK button is currently not supported out of the box.

    Regards,
    Alexander Popov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Cristina
    Cristina avatar
    6 posts
    Member since:
    Apr 2016

    Posted 29 Jul in reply to Alexander Popov Link to this post

    I know this is old, but I am having this same issue now as well.  I am grouping by a foreign key, and even tried adding a default value.  However, it still creates a new group (the new group is using the default value, which is an existing group, also odd...) and when I click cancel on the pop up editor, the new group and new row persist.  Any help or insight would be greatly appreciated!!  I was asked to add this property/foreign key specifically for grouping, so I need to get this right.

    Here is my model:

    public class RV_ReportViewModel
        {
            [ScaffoldColumn(false)]
            public int ReportId { get; set; }
            [DisplayName("Report Name")]
            public string ReportName { get; set; }
            [DisplayName("Report Path")]
            public string ReportPath { get; set; }
            [UIHint("GridForeignKey")]
            public int CategoryId { get; set; }
            public List<RV_ReportGroupsViewModel> Groups { get; set; }
        }

    Here is the code for my grid. 

    @(Html.Kendo().Grid<RV_ReportViewModel>()
                      .Name("gridReports")
                      .Columns(columns =>
                      {
                          columns.Bound(r => r.ReportName).Groupable(false);
                          columns.Bound(r => r.ReportPath).Groupable(false);
                          columns.ForeignKey(r => r.CategoryId,(System.Collections.IEnumerable)ViewData["categories"],"CategoryId","Name");
                          columns.Command(command =>
                          {
                              command.Edit();
                              command.Destroy();
                          }).Width(250);
                      })
                      .ClientDetailTemplateId("template")
                      .ToolBar(toolbar => toolbar.Create())
                      .Editable(editable => editable.Mode(GridEditMode.PopUp))
                      .Pageable()
                      .Sortable()
                      .Filterable()
                      .Groupable()
                      .DataSource(dataSource => dataSource
                          .Ajax()
                          .PageSize(10)
                          .Model(model =>
                          {
                              model.Id(s => s.ReportId);
                              model.Field(s => s.CategoryId).DefaultValue(1);
                          })
                          .Create(update => update.Action("Report_Create", "ReportViewer"))
                          .Read(read => read.Action("Report_Read", "ReportViewer"))
                          .Update(update => update.Action("Report_Update", "ReportViewer"))
                          .Destroy(update => update.Action("Report_Destroy", "ReportViewer"))))

     

  5. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 02 Aug Link to this post

    Hi Cristina,

    I am sending a sample runnable application which we can use as a reference point. Please modify the BatchSearch View in the attached sample ( run with /Home/BatchSearch ) to replicate the described scenario and send it back to us for further investigation.

    Regards,
    Eyup
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready