I recently noticed when double clicking on a cell to enter edit mode the cell inherits data in the top most column?
example grid
120000
If I double click on (row2:col0) my data becomes 1 in that cell, if I ESC to get out its now permanently 1. Same for (row3:col0).
Here is an example of data that causes this
[{"AM":"63.99902","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"}]
Anything I double click on in the AM row assumes 63.99902. If this is not a bug, then would could cause this? My edit starting and started events have no code in them.
FYI: my code has a infragistics suggested work around to the primary key. We dont use the pri key and all of our updates are direct to the TD followed by the JSON data being updated. In order for the code to work right we had to put in a dummy Key and in this case that key would be AM. more info on that here
http://es.infragistics.com/community/forums/p/85055/430952.aspx#430952
Ok I was right its that primary key stuff. I was able to replicate the issue see code.
please see this http://es.infragistics.com/community/forums/p/85055/430952.aspx#430952 Per this fix I should be able to use the infragistics code without the primary key. Here is another example of it failing to work. Change primaryKey: "Gain", to primaryKey: "AM", and the code works fine. Please understand ( per that link ) we can not use the pirmary key feature and asked if it were possible to handle updates another way. Setting a null primaryKey value does not work, so it was suggested to put in some random column.
I'm not sure the primary key is the culprit here but changing it make the problem go away. In the example below the following code will work fine. Chance primaryKey: to "AM" and now double clicking on anything under AM changes the cell data.
$.ig.loader(function () { $("#grid1").igGrid({ height: "500px", width: "750px", autoGenerateColumns: false, dataSource: [{"AM":"63.99902","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"},{"AM":"0","Gain":"0.5"}], responseDataKey: "results", dataSourceType: "json", columns: [ { headerText: "AM", key: "AM", dataType: "string", width: "150px" }, { headerText: "Gain", key: "Gain", dataType: "string", width: "150px" }], primaryKey: "Gain", features: [ { name: "ColumnFixing", columnSettings: [ { columnKey: "ProductName", isFixed: true } ], deferredResizing: false, allowDoubleClickToResize: true, columnResizing: function ( ) { return false;//dont want this } }, { name: "Selection", mode: "cell", multipleSelection: true, mouseDragSelect: true, // default value for selecting multiple cells with the mouse touchDragSelect: true, // default value for selecting multiple cells with a finger cellSelectionChanged: function ( evt, ui ) {}, cellSelectionChanging: function ( evt, ui ) {} }, { name: "Updating", editMode: "cell", enableAddRow: false, enableDeleteRow: false, startEditTriggers: "dblclick", editCellStarted: function ( evt, ui ){}, editCellStarting: function ( evt, ui ) { if ( evt.keyCode === 13 ) { //document.forms[0].submit(); return false; } }, editRowEnding: function ( evt, ui ){ }, editCellEnded: function ( evt, ui ){} }, { name: "Sorting", columnSorting: function ( evt, ui ) {} } ] }); });
Hello,
If the value you see in an editor is different than the one in the cell, this most likely means Updating was unable to find the correct record corresponding to the row being edited. If I read your example correctly, setting the primaryKey to "Gain" is very likely the culprit as the values in the Gain column are not unique. When that's the case your editors will get populated with the values of the first record that has the same PK as the one you are trying to edit.
My previous suggestion for updating without PK is only possible if you only update through separate UI, using the grid's API. Using Updating's UI does require an unique PK to avoid such conflicts. What I suggest is to traverse your data before initializing the grid and add a property to use as PK which you populate with a simple index. Then you can hide the column through the column settings:
columns: [
{ key: "Index", dataType: "number", hidden: true }
...
]
I realize you had some issues with this approach previously but I believe these can be worked around more easily than implementing a separate updating UI to circumvent Updating's dependency on a PK. Please, let me know about any issue you have with defining a dummy PK so I can help you with them promptly.
Best regards,
Stamen Stoychev