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

Grid inline edit removes row on click of another row while in edit mode

5 Answers 292 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vijeth
Top achievements
Rank 1
Vijeth asked on 23 Apr 2015, 01:12 PM

Hi,

     When i try to click on edit while there is a row in edit mode already the row gets removed. Please let me know if anybody have an idea?

I have tried with specifying Model.Id but of no use.

 

Note: I am using Kendo grid in ASP.NET MVC helper and this grid is loaded by ajax call in jquery by assigning datasource

5 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 27 Apr 2015, 08:44 AM
Hi Vijeth,

Indeed, this behavior occurs when no Model ID is specified, so I am not sure what else might be causing it. Would you please share the Grid configuration options and the related code as well? That would allow us to investigate further.

Regards,
Alexander Popov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Vijeth
Top achievements
Rank 1
answered on 27 May 2015, 02:45 PM

View containing the Grid configurations
@(Html.Kendo().Grid(Model.ProviderMapList)
.Name("ProviderMapListGrid")
.Pageable(page => page.Enabled(true))
.Sortable()
.Scrollable()
.Navigatable()
.Selectable()
.Groupable()
.HtmlAttributes(new { style = "height:100%;" })
.Pageable(
pager => pager.PageSizes(new int[] { 20, 50, 100 })
)
.Columns(columns =>
{
columns.Template(@<text></text>).HeaderTemplate("<a href='\\#' title=\"Expand All\"><img src='../Content/Images/icon-expand.jpg' onclick=\"javascript:ExpandProviderMapGroups();return false;\"\\>&nbsp&nbsp</a><a href='\\#' title=\"Collapse All\"><img src='../Content/Images/icon-collapse.jpg' onclick=\"javascript:CollapseProviderMapGroups();return false;\" \\></a>").Width(50);
columns.Bound(p => p.Value).ClientGroupHeaderTemplate("Value: #=value# &nbsp&nbsp &nbsp&nbsp&nbsp&nbspCount:#=count#");
columns.Bound(p => p.SvcType).ClientGroupHeaderTemplate("SvcType: #=value# &nbsp&nbsp &nbsp&nbsp&nbsp&nbspCount:#=count#");
columns.Bound(p => p.FacilityProviderTypeId).EditorTemplateName("ProviderTypes").ClientTemplate("#=FacilityProviderType#").Title("Provider Type").ClientGroupHeaderTemplate("Provider Type: #=value# &nbsp&nbsp &nbsp&nbsp&nbsp&nbspCount:#=count#");
columns.Command(command => { command.Edit().HtmlAttributes(new { title = "Edit" }); }).Width(172);
columns.Command(command => { command.Destroy().HtmlAttributes(new { title = "Delete" }); }).Width(172);
})
.DataSource(dataSource => dataSource
.Ajax()
.Aggregates(aggregates => aggregates.Add(p => p.Value).Count())
.Aggregates(aggregates => aggregates.Add(p => p.SvcType).Count())
.Aggregates(aggregates => aggregates.Add(p => p.FacilityProviderTypeId).Count())
.ServerOperation(false)
.Model(model =>
{
model.Id(x => x.ProviderMapId);
model.Field(x => x.FacilityProviderTypeId);
})
.PageSize(20)
.Update(update => update.Action("UpdateProviderMap", "Remit835").Type(HttpVerbs.Post))
.Destroy(update => update.Action("DeleteProviderMap", "Remit835").Type(HttpVerbs.Post))
)
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.Events(events => events.Cancel("onCancel"))
)

Javascript function that is binding the data to the grid

function Remit835Call(facilityId) {
        blockUI
        var model = new Object();
        model.FacilityId = facilityId;
        var providerMapListGrid = $('#ProviderMapListGrid');
        var payerTypeListGrid = $('#PayerTypeGrid');
        var payerTypeMasterListGrid = $('#PayerTypeMasterGrid');
        blockUI();
        var successCallbackMethod = function (response) {
            var providerMapGrid = providerMapListGrid.data("kendoGrid");
            var providerMapDatasource = providerMapGrid.dataSource;
            providerMapDatasource.data(response.reply.data.ProviderMapList);           
            unblockUI();
        };
        var errorCallbackMethod = function (reply) {
            alert(reply);
            unblockUI();
        }
        $.ajax({
            type: 'GET',
            url: Remit835Setup,
            data: model,
            cache: false,
            dataType: 'json',
            contentType: 'application/json',
            success: successCallbackMethod,
            error: errorCallbackMethod
        });
    }

Controller action that is sending data to the ajax call

public JsonResult Remit835FacilityFilter(Remit835Filter filter)
        {
            Remit835SearchModel remit835SearchModel = new Remit835SearchModel();
          
            var remit835ProviderMapDto = _remit835FacilityService.PopulateProviderMapList(filter.FacilityId);
            remit835SearchModel.ProviderMapList = (from o in remit835ProviderMapDto
                                                   select new Remit835ProviderMapViewModel()
                                                   {
                                                       ProviderMapId = o.ProviderMapId,
                                                       FacilityName = o.FacilityName,
                                                       FacilityProviderType = o.FacilityProviderType,
                                                       Value = o.Value,
                                                       SvcType = o.SvcType,
                                                       FacilityId = o.FacilityId,
                                                       FacilityProviderTypeId = o.FacilityProviderTypeId,
                                                       InsertUser = o.InsertUser,
                                                       ProviderTypeList = FillFacilityProviderTypes(),
                                                   }).ToList();
            JsonResult jsonResult = Json(
                              new
                              {
                                  reply = new
                                  {
                                      data = remit835SearchModel
                                  }
                              }
                             , JsonRequestBehavior.AllowGet);
            return jsonResult;
        }

0
Alexander Popov
Telerik team
answered on 29 May 2015, 11:05 AM
Hello Vijeth,

Thank you for the provided code snippets. The behavior is expected when working with server editing and there is no workaround that I could recommend, other than using Ajax editing instead.

Regards,
Alexander Popov
Telerik
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
Vijeth
Top achievements
Rank 1
answered on 29 May 2015, 01:54 PM

Hi Alexander,

     Thanks for the response. If you can see the code snippet in the view i do have mentioned datasource.Ajax(). But still when you click edit button while there is another editing row available the existing and later all the rows of the grid disappears.

Appreciate your thoughts on this.

0
Alexander Popov
Telerik team
answered on 02 Jun 2015, 11:33 AM
Hello Vijeth,

I apologize for missing that. I reviewed the code again, however I did not notice anything suspicious and so far I was unable to reproduce this behavior locally. I am also not sure how and when the Remit835Call function is called, but it seem it replaced the Grid's DataSource items. Would you be able to provide a runnable sample project where this is isolated, so we can investigate further? You might need opening a new support ticket, as the attachment size in the forums is limited to 2mb.

Regards,
Alexander Popov
Telerik
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
Tags
Grid
Asked by
Vijeth
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Vijeth
Top achievements
Rank 1
Share this question
or