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

[Solved] Possible Bug - InCell Editing

1 Answer 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Henry
Top achievements
Rank 1
Henry asked on 07 Jun 2011, 04:34 AM
I'm newer in Telerik MVC controls. I met a bug when I was using incell editing model. The following are reproduce steps:

@(Html.Telerik().Grid<Role>()
    .Name("Grid")
    .DataKeys(keys =>
    {
        keys.Add(r => r.RoleId);
    })
    .ToolBar(commands =>
    {
        commands.Insert();
        commands.SubmitChanges();
    })
    .DataBinding(dataBinding =>
        dataBinding.Ajax()
            .Select("_SelectBatchEditing", "Account")
            .Update("_SaveBatchEditing", "Account")
    )
    .Columns(columns =>
    {
        columns.Bound(r => r.RoleName).Width(200);
        columns.Bound(r => r.RoleDesc).Width(500);
        columns.Bound(r => r.IsDeleted).ClientTemplate("<input type='checkbox' disabled='disabled' name='IsDeleted' <#= IsDeleted? checked='checked' : '' #> />");
    })
    .ClientEvents(events => events.OnDataBinding("Grid_onDataBinding").OnError("Grid_onError"))
    .Editable(editing => editing.Mode(GridEditMode.InCell).DefaultDataItem(new Role()))
    .Pageable(paging => paging.Style(GridPagerStyles.PageInput | GridPagerStyles.Numeric | GridPagerStyles.NextPrevious))
    .Resizable(resizing => resizing.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
    .Pageable()
    .Sortable()
)


1. Click "Add new record" button
2. Change to other page by clicking the pager link.
3. Browser will prompt confirmation: You are going to lose any unsaved changes. Are you sure?
4. Click "Yes" to give up the any changes.
5. Page changed, but if you click the first row to edit it, you will meet the bug, the edit box shows blank instead of original content.

My solution:

function Grid_onDataBinding(e) {
    var grid = $(this).data('tGrid');
    if (grid.hasChanges()) {
        if (!confirm('You are going to lose any unsaved changes. Are you sure?')) {
            e.preventDefault();
        }
        else {
            $(".t-grid-cancel-changes").click();
        }
    }
}

The version of MVC control is: Q1 2011 517

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 07 Jun 2011, 09:41 AM
Hi Henry,

 I confirm this is a bug and your workaround is a feasible solution until we fix it. I have updated your Telerik points.

Regards,
Atanas Korchev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Henry
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or