I have a simple igGrid that I want to have edit, add and delete features. The problem is if I don't have primaryKey property set up, the delete/add does not work.
If I have primaryKey set up, when I double click the grid row to enter edit mode, the grid clears the original data instead of persisting it. Is there a workaround to this issue ?
Hello Jeffery,
Thank you for the update. That is correct that would be why the issue was occurring. The datatype should be set to one of the following string, number, date, or bool. If you want the number to be formatted a certain way you can use the format property of the column. Please see the following documentation for further information:
http://help.infragistics.com/NetAdvantage/jQuery/2012.1/CLR4.0?page=igGrid_Columns_and_Layout.html
Please let me know if you have any questions concerning this matter.
Sincerely,Mike P.Developer Support EngineerInfragistics, Inc.www.infragistics.com
Mike,
I changed the dataType of the Primary Key column from int to number and that seems to have fixed the problem.
Thanks,
Jeffrey
Yes, I did set the data type, below is my code snippet
Html.Infragistics().Grid<SRP.Pricing.Models.ItemModel>() .AutoGenerateColumns(false) .Width("1300px") .PrimaryKey("ItemId") .ID("grid1") .Columns(column => { column.For(li => li.ItemId).DataType("int").HeaderText(" ").Width("1px"); column.For(li => li.Level).DataType("int").HeaderText("Level"); }) .Features(features => { features.Updating() .EnableAddRow(true) .EnableDeleteRow(true) .EditMode(GridEditMode.Cell); features.Paging() .PageSize(10) .PrevPageLabelText("Previous") .NextPageLabelText("Next"); features.Sorting(); features.Selection() .MouseDragSelect(true) .MultipleSelection(true) .Mode(SelectionMode.Row); features.Resizing() .AllowDoubleClickToResize(true); features.RowSelectors() .EnableCheckBoxes(true) .EnableRowNumbering(false); features.Hiding(); }) .DataSourceUrl(@Url.Action("GetItems")) .DataBind() .Render()
Hello jAndika,
Thank you for contacting Infragistics!We received your support request concerning the data being cleared from rows when edit mode has been entered, and this case has been assigned to me. Infragistics is dedicated to helping you solve this issue. Our team and I have done an initial review of your case and you will want to make sure you set the datatype of the column you are using as a primaryKey.