Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 78072

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

$
0
0

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

 


Viewing all articles
Browse latest Browse all 78072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>