Hi,
I've noticed that after DynamicForm we are getting a corrupted ecord from getData(), some fields appear, e.g. "_selection_1" ...
Tested: latest Smartclient 10.0 LGPL 2016-02-03, 2016-01-15
Steps:
1) select any record from listgrid
2) click "save"
Then "this.selection.select(updatedRecord);"isc.ListGrid.addMethods.performReselectOnUpdate(), ISC_Grids.js:31793" is called it will corrupt response from server,
stack:
isc.addProperties.performReselectOnUpdate(), ISC_Core.js:76707
isc.Selection.addMethods.dataChanged(), ISC_Grids.js:6334
isc.Selection.addMethods.dataArrived(), ISC_Grids.js:6313
---
and this response is passed into DynamicForm._saveValues() ( @ isc.EditorActionMethods.addInterfaceMethods._saveDataReply(), ISC_DataBinding.js:52506 )
so my DynamicForm will get some random field "_selection_1" out of no there.
performReselectOnUpdate(modifiedRecord) will call this.selection.select(updatedRecord) which adds "_selection_1" property to response.,
and modifiedRecord === updatedRecord . Do not know is this due to clientOnly DataSource, but we see this behavior also in our production code.
PS. As I workaround now I use reselectOnUpdate:false;
I've noticed that after DynamicForm we are getting a corrupted ecord from getData(), some fields appear, e.g. "_selection_1" ...
Tested: latest Smartclient 10.0 LGPL 2016-02-03, 2016-01-15
Steps:
1) select any record from listgrid
2) click "save"
Code:
var listGrid;
var ds = isc.DataSource.create({
ID: "ds",
clientOnly: true,
fields: [{name: 'id', primaryKey: true}, {name: 'title', type: 'text'}],
testData: [
{
id: 1,
title: 'Hello world'
},
{
id: 2,
title: 'Inside-Outside'
},
{
id: 3,
title: 'High-Low'
}
]
});
var listgrid, form, output;
var layout = isc.VLayout.create({
// reselectOnUpdate: false, // uncomment this and problem is fixed.
autoDraw: true,
width: "500",
height: "300",
members: [
listgrid = isc.ListGrid.create({
autoFetchData: true,
width: "100%",
height: "300",
dataSource: "ds",
recordClick: function () {
form.editSelectedData(listgrid);
}
}),
form = isc.DynamicForm.create({
dataSource: "ds",
fields: [
{
name: "title",
type: "text"
}
]
}),
isc.Button.create({
title: 'Save',
click: function () {
form.saveData(function () {
output.setContents('<br/>getData(): ' + JSON.stringify(form.getData()) + '<br/>'
);
});
}
}),
output = isc.HTMLFlow.create({
width: "100%",
height: "30"
})
]
});
Then "this.selection.select(updatedRecord);"isc.ListGrid.addMethods.performReselectOnUpdate(), ISC_Grids.js:31793" is called it will corrupt response from server,
stack:
isc.addProperties.performReselectOnUpdate(), ISC_Core.js:76707
isc.Selection.addMethods.dataChanged(), ISC_Grids.js:6334
isc.Selection.addMethods.dataArrived(), ISC_Grids.js:6313
---
and this response is passed into DynamicForm._saveValues() ( @ isc.EditorActionMethods.addInterfaceMethods._saveDataReply(), ISC_DataBinding.js:52506 )
so my DynamicForm will get some random field "_selection_1" out of no there.
performReselectOnUpdate(modifiedRecord) will call this.selection.select(updatedRecord) which adds "_selection_1" property to response.,
and modifiedRecord === updatedRecord . Do not know is this due to clientOnly DataSource, but we see this behavior also in our production code.
Code:
dataChanged : function (operationType,originalRecord,rowNum,updateData,filterChanged,dataFromCache) {
if (this._ignoreNextDataChanged) {
delete this._ignoreNextDataChanged;
return;
}
if (this.reselectOnUpdate && operationType == "update" && originalRecord != null &&
originalRecord[this.selectionProperty])
{
var modifiedRecord = this.data.findByKey(originalRecord);
if (modifiedRecord) this.performReselectOnUpdate(modifiedRecord); // modifiedRecord === updateDate !
// so if modifiedRecord is updated, also updateData is updated. and this data is passed into DynamicForm.
PS. As I workaround now I use reselectOnUpdate:false;
Comment