Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
935
Null PrimaryKey in igGrid causing unmapped grid items to transform into first mapping created
posted

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()
)

Parents Reply Children