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

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

5 Answers 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 04 Nov 2013, 07:32 PM
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!

5 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 06 Nov 2013, 01:01 PM
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!
0
Cristina
Top achievements
Rank 1
answered on 29 Jul 2016, 05:10 PM

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"))))

 

0
Eyup
Telerik team
answered on 02 Aug 2016, 02:38 PM
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
0
Tom
Top achievements
Rank 1
answered on 24 Jul 2017, 11:44 AM

Hi Eyup,

 I know this is just under 12 months old but I am having the exact same issue as above. I have added the DefaultValue but experience the same behavior. Did you guy's come up with a resolution?

 I can provide more details if required.

Thanks

Tom

0
Vasil
Telerik team
answered on 26 Jul 2017, 03:54 PM
Hello Tom,

At the moment there is no workaround that to be universal and to work in all configurations of the grid.

The new item have only top and bottom position to be placed at. And this is the reason it creates a group to be visible in. It is the desired approach and we do not plan to change it.

Regards,
Vasil
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Cristina
Top achievements
Rank 1
Eyup
Telerik team
Tom
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or