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
Can anyone help me with this please.. I'm still stuck
Hello,
If autoCommit property is set to true grid commits the transactions as rows/cells are being edited. You can also handle pageIndexChanged event and commit changes using below line of code:
$(".selector").igGrid("commit");
You can find mode details on grid API on the below link:
<http://help.infragistics.com/jQuery/2012.2/ui.iggrid>
If this behavior is still present, please provide me with the grid initialization code so I may look in to this.
I hope this helps.
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 ?
@(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()
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.
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.