I have a grid with 3 columns. The first is one we use to create a unique index for each row and is hidden. The second column is SampleID and contains a pre-assigned value that is read only. The third column, "Part" contains a combo that lets the user select a value. In my actual code I have a formatter and stuff but for the sake of demonstrating my problem it's irrelevant, so not included...
The way the grid should work is that the user will be given a list of "SampleIds" and for each SampleID the user should select a "Part".The problem is when the user selects a Part, the sample column in that row gets changed to null. I can't figure out why... The SampleId should remain unchanged.Code example follows:
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Grid Test</title> <link href="Content/themes/infragistics2012/infragistics.theme.css" rel="stylesheet"> <link href="Content/structure/infragistics.css" rel="stylesheet"> <script type="text/javascript" src="Scripts/jquery-1.9.1.js"></script> <script type="text/javascript" src="Scripts/jquery-ui-1.10.2.js"></script> <script type="text/javascript" src="Scripts/infragistics.core.js"></script> <script type="text/javascript" src="Scripts/infragistics.lob.js"></script> <script type="text/javascript"> $(document).ready(function() { var gridOptions = { "mergeUnboundColumns": false, "enableUTCDates": false, "width": "100%", "localSchemaTransform": false, "autoGenerateColumns": false, "autoCommit": false, "dataSource": [{ "SampleId": "88-PR0813201800595", "PartId": 0 }, { "SampleId": "88-PR0813201800596", "PartId": 0 }, { "SampleId": "88-PR0813201800597", "PartId": 0 }, { "SampleId": "88-PR0813201800598", "PartId": 0 }, { "SampleId": "88-PR0813201800599", "PartId": 0 }], "responseDataKey": "Records", "primaryKey": "Index", "columns": [{ "key": "Index", "dataType": "number", "headerText": "Index", "hidden": true }, { "key": "SampleId", "dataType": "string", "headerText": "Sample Id" }, { "key": "PartId", "dataType": "string", "format": "combobox", "headerText": "Part" }], "features": [{ "name": "Sorting", "type": "local", "caseSensitive": false }, { "columnSettings": [], "name": "Filtering", "type": "local", "caseSensitive": false, "mode": "simple" }, { "columnSettings": [{ "columnKey": "SampleId", "required": false, "readOnly": true, "validation": false }, { "columnKey": "PartId", "required": true, "editorType": "combo", "editorOptions": { "valueKey": "PartId", "textKey": "DisplayName", "dataSource": [{ "PartId": 1, "DisplayName": "Thigh" }, { "PartId": 2, "DisplayName": "***" }, { "PartId": 3, "DisplayName": "Wing" }, { "PartId": 4, "DisplayName": "Drumette" }] }, "validation": false }], "name": "Updating", "horizontalMoveOnEnter": true, "validation": true, "enableAddRow": false, "enableDeleteRow": false, "editMode": "row", "showDoneCancelButtons": true, "startEditTriggers": "dblclick,f2" }, { "name": "Selection", "mode": "row", "multipleSelection": false }, { "showPageSizeDropDown": true, "name": "Paging", "type": "local", "pageSize": 20 }, { "name": "Resizing", "deferredResizing": false }] } grid = $("#grid").igGrid(gridOptions); }); </script></head><body> <h1>Grid</h1> <div> <table id="grid"></table> </div></body></html>
Hello Pete,
I am glad you found my solution helpful.In case you have any additional questions don’t hesitate to ask them.
Thank you for using Infragistics.
Thank you. That was exactly it.I actually have a code generator that I wrote that generates most of the grid code for our app, but this particular grid is very different from the others in our app, so I'm doing everything by hand for the first time in a long time and re-learning all the little details that I need to make them work...
Thanks.
Hello Pete,Thank you for posting in our community.After testing the grid configuration provided I noticed that the “Index” column, set as a primary key, doesn’t have value in the dataSource. Using grid without having primaryKey may lead to unexpected behavior in some of the features.Attached you will find the updated sample where I have added index values. I tested this on my side and when the “Part” column is in edit mode a dropdown appears and a part can be selected. Feel free to test it and let me know if you have additional questions. In case this is not a correct representation of what you are trying to achieve feel free to correct me.
0385.sample.zip