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

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

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