Grid datasource create event fired twice

3 posts, 0 answers
  1. DevGuy
    DevGuy avatar
    1 posts
    Member since:
    Mar 2013

    Posted 28 Aug 2013 Link to this post

    I am using the popup feature of kendoui grid to add/edit a record. The kendoui version that I am using is 2013.2.823. I find that whenever I click the "update" button to create/edit a record the create event is fired twice (see attached image). Any help would be much appreciated.

    Soure Code:

               .ToolBar(toolbar => toolbar.Create())
                   //.Events(e => e.DataBound("grid_DataBound"))
               .Editable(editable => editable.Mode(GridEditMode.PopUp).DisplayDeleteConfirmation(true).CreateAt(GridInsertRowPosition.Top))
               .Pageable(p => p.Enabled(true).PageSizes(new[] { 10, 20, 30 }).Refresh(true).PreviousNext(true).ButtonCount(4).Info(true).Numeric(true))
               .Navigatable(n => n.Enabled(true))
               .Resizable(r => r.Columns(true))
               .Scrollable(s => s.Height("auto"))
               .Selectable(s => s.Enabled(false).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
               //.RowAction(row => { })
               .Sortable(sorting =>
               .Filterable(filterable => filterable
                               .Operators(operators => operators
                                               .ForString(str => str.Clear()
                                                                       .StartsWith("Starts with")
                                                                       .EndsWith("Ends with")
                                                                       .IsEqualTo("Is equal to"))
                                               .ForNumber(num => num.Clear()
                                                                       .IsEqualTo("Is equal to")
                                                                       .IsGreaterThan("Is greater than")
                                                                       .IsGreaterThanOrEqualTo("Is greater than or equal to")
                                                                       .IsLessThan("Is less than")
                                                                       .IsLessThanOrEqualTo("Is lesss than or equal  to"))
                                               .ForDate(date => date.Clear()
                                                                       .IsEqualTo("Is equal to")
                                                                       .IsGreaterThan("Is after")
                                                                       .IsGreaterThanOrEqualTo("Is after or equal to")
                                                                       .IsLessThan("Is before")
                                                                       .IsLessThanOrEqualTo("Is before or equal to"))
               .Columns(columns =>
                       //columns.Bound(p => p.PROV_GRP_ID).Visible(false).Width(100);
                       columns.Command(command => { command.Edit(); }).Width(75);
                       columns.Bound(p => p.PROV_GRP_KEY).Visible(true).Width(50);
                       columns.Bound(p => p.GroupName).Width(150);
                       columns.Bound(p => p.ContactFirstName).Width(120);
                       columns.Bound(p => p.ContactLastName).Width(120);
                       columns.Bound(p => p.ContactTitle).Width(100);
                       columns.Bound(p => p.PhoneNumber).Width(100);
                       columns.Bound(p => p.StreetAddress1).Width(150);
                       columns.Bound(p => p.StreetAddress2).Width(100);
                       columns.Bound(p => p.City).Width(150);
                       columns.Bound(p => p.State).Width(50);
                       columns.Bound(p => p.Zip).Width(50);
                       columns.Bound(p => p.Email).Width(150);
                       columns.Bound(p => p.IsDeleted).Width(50);
                       //columns.Bound(p => p.IsDeleted).ClientTemplate("#kendo.template($('#tmplActionMenu').html())#").HeaderTemplate(p => "Action").Width(100);
                      .DataSource(dataSource => dataSource
                           .Events(events => events.Error("grid_dataSource_OnError"))
                           .Model(m =>
                               m.Id(p => p.PROV_GRP_KEY);
                               //m.Field(f => f.PROV_GRP_KEY).Editable(false);
                               //m.Field(f => f.IsDeleted).Editable(false);
                           .Read(read =>
                                   read.Action("GetGroups", "Roster");
                           .Create(create =>
                                   create.Action("CreateGroup", "Roster");
                           .Update(update =>
                                   update.Action("UpdateGroup", "Roster");
                           .Destroy(destroy =>
                                   destroy.Action("DeleteGroup", "Roster");
  2. Femi
    Femi avatar
    1 posts
    Member since:
    Oct 2015

    Posted 20 Oct 2017 Link to this post

    I am having this same issue. Any ideas why my Create action of the grid is posting twice to my controller?
  3. Stefan
    Stefan avatar
    2752 posts

    Posted 24 Oct 2017 Link to this post

    Hello, Femi,

    In general, such issue can occur if the ID is not correctly set in the dataSource or the Grid does not receive a success callback with the new records.

    Please check if the first request receives a success callback with the ID before the second request is made.

    I can suggest checking our article for the CRUD operations as it contains the required steps when binding the Grid:

    If the issue still occurs, please provide a fully runnable example and I will gladly assist further.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top