Of necessity, I have a list of Mappings but am pulling unmapped lists as part of the result set when the igGrid is setup. Everything works fine (including using dropdown selector for blank field to send to back-end to map to the list displayed across 3 columns), until an unmapped list becomes a mapped list; it then replaces all the unmapped list items until I refresh the page.
What I need is a way to designate a generic identifier to assign for the gridObject.rowId so each row is unique within the grid. I assume the fast track to this solution is using a ternary to assign a generic PrimaryKey when the mapping Guid = Guid.Empty (unmapped).
My formatting is in Razor, as follows:
@(Html.Infragistics().Grid<XeusDesignMapping>() .ID(gridId) .AutoCommit(true) .AutoGenerateColumns(false) .AutoGenerateLayouts(false) .ResponseDataKey(null) .PrimaryKey("MapId") .Caption("XEUS Design Mappings") .Rest(true) .Columns(column => { column.For(x => x.MapId).HeaderText("Mapping Id").DataType("string").Hidden(true); column.For(x => x.DesignId).HeaderText("Commits Id").DataType("string").Hidden(true); column.For(x => x.Design).HeaderText("Commits Design").DataType("string"); column.For(x => x.ListId).HeaderText("List Id").DataType("string").Hidden(true); column.For(x => x.Product).HeaderText("XEUS Product").DataType("string"); column.For(x => x.Type).HeaderText("Lot Type").DataType("string"); column.For(x => x.Title).HeaderText("Lot Title").DataType("string"); if (securityUnLocked) // only Admin can edit and delete xeus design mappings column.Unbound("Actions").HeaderText("Actions").Template("<a title='Edit Mapping' href='#' onclick='editRow(\"" + gridId + "\", \"${MapId}\")'>Edit</a> | <a title='Delete Mapping' href='#' onclick='deleteRow(\"" + gridId + "\", \"${MapId}\")'>Delete</a>"); }) .Features(features => { features.Sorting().Type(OpType.Local); features.Filtering().Type(OpType.Local); features.Paging().PageSize(20).Type(OpType.Local); features.Selection().Mode(SelectionMode.Row); features.Resizing(); features.Updating().EnableAddRow(true).EnableDeleteRow(false) .AddClientEvent("rowAdding", "gridHideDefaultRow") .AddClientEvent("editRowEnding", "saveEditedRow") .ColumnSettings(settings => { //ColumnKey is the value from the array x above settings.ColumnSetting().ColumnKey("Design").EditorType(ColumnEditorType.Combo).Required(true).ComboEditorOptions(co => co.DataSource(Model.Designs).ID("designDD").ValueKey("Name").TextKey("Name").Mode(ComboMode.DropDown)); }); }) .DataSourceUrl("/design/GetXeusDesignMappings/") .DataBind() .Render() )
That's not the case at all. Each design name is vetted to exist only once with an active design row. If it's not active, it won't appear in the grid. If someone attempts to duplicate a design name, it will resolve an error popup that will inform them they cannot do this.
Because the ListId isn't duplicated in the database, I decided to make it the PrimaryKey. It won't be an issue since, despite the fact that unlimited copies of the Design/DesignId are allowed, each ListId will only ever have one instance.
Hello Chris,
I am glad that you find Maya`s suggestion helpful.
Thank you for using Infragistics components!
That makes sense. The fields we use in this sheet are Guids and Strings.
Thanks for your time.
I’ve attached a sample for your reference with the previously suggested implementation.
5852.GridWithUnboundColumn.zip
Please refer to it and let me know if you have any questions.
Note that the data type of the generated value should match the type you use when calling the igGrid API methods. So if for example the generated values are type number (1,2,3 etc.) but you are passing the value as string and calling the API methods with the string values (“1”, “2”, “3” etc.) then an error would be thrown as there would be no primary key field matching that value.
Let me know if you have any additional questions or if you require additional assistance.
Regards,
Maya Kirova