What is the best way to persist user's changes inside the grid when I'm using remote paging/sorting for the grid ?
The problem right now is that when I make changes on the first page, go to the next page, go back, my changes are gone. I tried doing igGrid('commit') inside updatingDataDirty and editRowEnded event without any success.
$("#grid").on("iggridupdatingdatadirty", function (event, ui) { $("#grid").igGrid("commit"); return false; });
I thought I read somewhere in the API doing commit should solve this issue, I might be missing something here. Please Help.
Thanks,
Jeffrey
Bhadresh,
I'm pretty sure it's either because the default is remote or because I'm setting DataSourceUrl property of the grid. Because on all my grids, I've never set the operation type, and it's always remote by default.
Hello,
Thank you for the razor syntax. I am not certain how you are implemented remote paging since the syntax should be something like below for remote paging/sorting:
features.Paging().PageSize(50).Type(OpType.Remote); features.Sorting().Type(OpType.Remote);
I will open a new private support case CAS-102823-H0F1Y6 to provide you more details on this. I will post resolution on the forums once it reached.
I hope this helps.
@(Html.Infragistics().Grid<Model>()
.AutoGenerateColumns(false)
.EnableHoverStyles(false)
.Width("100%")
.PrimaryKey("Id")
.ID("grid")
.Columns(column =>
{
column.For(li => li.Price).DataType("number").HeaderText("Price").Width("50px");
column.For(li => li.Code).DataType("string").HeaderText("Code").Width("110px");
column.For(li => li.Description).DataType("string").HeaderText("Description");
column.For(li => li.Id).DataType("number").HeaderText(" ").Width("1px");
})
.Features(features =>
features.Updating()
.EnableAddRow(true)
.EnableDeleteRow(true)
.EditMode(GridEditMode.Row)
.ColumnSettings(s =>
s.ColumnSetting().ColumnKey("Price").Required(true).EditorType(ColumnEditorType.Combo)
.ComboEditorOptions(o =>
o.EnableClearButton(false).TextKey("Price").ValueKey("Price").AllowCustomValue(true)
.ValidatorOptions(option =>
option.KeepFocus(ValidatorKeepFocus.Never).OnBlur(false).OnSubmit(true);
option.CustomErrorMessage("Price is required");
});
s.ColumnSetting().ColumnKey("Code").EditorType(ColumnEditorType.Combo)
.ComboEditorOptions(options => { options.TextKey("Code").ValueKey("Description").AllowCustomValue(true); });
s.ColumnSetting().ColumnKey("Id").ReadOnly(true);
features.Paging()
.PageSize(10)
.PrevPageLabelText("Prev")
.NextPageLabelText("Next");
features.Resizing()
.DeferredResizing(true);
features.Sorting();
.DataSourceUrl(Url.Action("GetModels", new { id = ID }))
.UpdateUrl(Url.Action("CommitChanges", new { Id = ID }))
.DataBind()
.Render()
Thanks for the reply Bhadresh.
I can't enable autoCommit because it is required to do batch updating on the screen.
When I call 'commit' igGrid will save the changes to the client data source right ? now since I'm doing remote paging/sorting, everytime it gets the data from the server, it overrides the client data source with whatever it's getting from the server.
Just like in the data dirty event handler that I have. I know the handler gets called, so the commit is executed but the new data overrides the client data source.
Are you saying that is a grid config issue ?
I am just following up to see if you need any further assistance with this matter.