Hi there,
Im trying to use a two-column ListGrid. I am using a selectionUpdated event to check for changed values and send them to my server - afterwards, I call saveAllEdits. To have a default value in the first column I implemented a simple formatEditorValue for the first column which returns Foo if the records value is undefined. To detect the changes, I iterate over the changed rows and their fields to determine which of them have changed.
If I edit a field in the second column, any value beyond the first generated by the formatEditorValue does not seem to get recognized by the rows changed fields. You can find my code below - is this intended behavior?
The issue is reproducible in the latest Chrome (53.0.2785.143 m), Firefox (47.0.1) and IE (10.0.9200.17609) with nightly build SmartClient_v110p_2016-10-05_Pro
Best regards
Im trying to use a two-column ListGrid. I am using a selectionUpdated event to check for changed values and send them to my server - afterwards, I call saveAllEdits. To have a default value in the first column I implemented a simple formatEditorValue for the first column which returns Foo if the records value is undefined. To detect the changes, I iterate over the changed rows and their fields to determine which of them have changed.
If I edit a field in the second column, any value beyond the first generated by the formatEditorValue does not seem to get recognized by the rows changed fields. You can find my code below - is this intended behavior?
The issue is reproducible in the latest Chrome (53.0.2785.143 m), Firefox (47.0.1) and IE (10.0.9200.17609) with nightly build SmartClient_v110p_2016-10-05_Pro
Best regards
Code:
isc.ListGrid.create({ "ID" : "demoListGrid", "width" : "300", "height" : "180", "canEdit" : true, "autoSaveEdits" : false, "selectionUpdated" : function () { var editRowsArray = demoListGrid.getAllEditRows(); console.log(editRowsArray); for (changedRowIndex = 0; changedRowIndex < editRowsArray.length; changedRowIndex++) { var changedRecordIndex = editRowsArray[changedRowIndex]; var record = demoListGrid.getRecord(changedRecordIndex); var gridFields = demoListGrid.getAllFields(); for (gridFieldIndex = 0, visibleGridFieldIndex = 0; gridFieldIndex < gridFields.length; gridFieldIndex++, visibleGridFieldIndex++) { var gridField = gridFields[gridFieldIndex]; var editValue = demoListGrid.getEditValue(changedRecordIndex, visibleGridFieldIndex); outputCanvas.setContents(outputCanvas.getContents() + "</br>" + gridField.name + " := " + editValue); } } setTimeout(function () { demoListGrid.saveAllEdits(); }, 1) }, "fields" : [{ "name" : "fooField", "title" : "fooField", "type" : "text", "width" : 130, "formatEditorValue" : function (value, record, rowNum, colNum, grid) { if (value == undefined) { return "Foo" } else { return value } }, "canEdit" : true }, { "name" : "otherField", "title" : "otherField", "type" : "text", "width" : 130, "canEdit" : true } ], "data" : [{}, {}, {} ] }), isc.Canvas.create({ "ID" : "outputCanvas", left : 300, width : 400 })
Comment