Hi,
I have a ListGrid with deferred removal that shows data from a DataSource filtered by a field. When I attempt to perform a remove operation, I always get a JavaScript error when saving changes.
You can reproduce it by using the following code snippet:
Steps to reproduce:
1- Mark for removal the two records in the ListGrid.
2- Confirm your removal by clicking the save button.
3- You will see that only one record gets removed, and find a JavaScript error in your browser console.
JavaScript error stack trace:
Browser: Google Chrome 47.0.2526.111 m
SmartClient version: v10.1p_2016-01-21
I have a ListGrid with deferred removal that shows data from a DataSource filtered by a field. When I attempt to perform a remove operation, I always get a JavaScript error when saving changes.
You can reproduce it by using the following code snippet:
Code:
isc.RestDataSource.create({
ID: "ds",
fields: [
{name: "pk", type: "sequence", primaryKey: true, hidden: true},
{name: "fk", type: "sequence"},
{name: "value", type: "sequence"}
],
clientOnly: true,
cacheData: [
{pk: 1, fk: 1, value: 1},
{pk: 2, fk: 1, value: 2},
{pk: 3, fk: 2, value: 3},
{pk: 4, fk: 2, value: 4}
]
});
isc.Button.create({
ID: "saveBtn",
title: "save",
action: function() {
list.saveAllEdits();
}
});
isc.ListGrid.create({
ID: "list",
canRemoveRecords: true,
deferRemoval: true,
dataSource: ds,
});
list.fetchData({fk: 1});
isc.VLayout.create({
ID: "testLayout",
members: [
saveBtn,
list
]
});
1- Mark for removal the two records in the ListGrid.
2- Confirm your removal by clicking the save button.
3- You will see that only one record gets removed, and find a JavaScript error in your browser console.
JavaScript error stack trace:
Code:
*17:16:35.472:TMR2:WARN:Log:TypeError: Cannot read property '0' of undefined
Stack from error.stack:
get(<no args: exited>) on [ResultSet ID:isc_ResultSet_3 (dataSource: ds, created by: list)] @ ISC_DataBinding.js.jsf:45939:37
discardEdits(<no args: exited>) on[ListGrid ID:list] @ ISC_Grids.js.jsf:53534:45
removeDataComplete(<no args: exited>) on[ListGrid ID:list] @ ISC_Grids.js.jsf:55977:22
fireCallback(callback=>Obj, argNames=>"dsResponse,data,dsRequest", args=>Array[3], target=>[ListGrid ID:list], catchErrors=>undef) on [Class RestDataSource] @ ISC_Core.js.jsf:6805:36
fireCallback(callback=>Obj, argNames=>"dsResponse,data,dsRequest", args=>Array[3], catchErrors=>undef) on [RestDataSource ID:ds] @ ISC_Core.js.jsf:8653:32
fireResponseCallbacks(dsResponse=>Obj, dsRequest=>Obj, rpcResponse=>Obj, rpcRequest=>Obj) on [RestDataSource ID:ds] @ ISC_DataBinding.js.jsf:18784:39
_completeResponseProcessing(data=>Obj, dsResponse=>Obj, dsRequest=>Obj, rpcResponse=>Obj, rpcRequest=>Obj) on [RestDataSource ID:ds] @ ISC_DataBinding.js.jsf:18735:14
callback(dsResponse=>Obj) on [RestDataSource ID:ds] @ ISC_DataBinding.js.jsf:16510:18
_handleClientOnlyReply(rpcResponse=>Obj, data=>Obj, rpcRequest=>Obj) on [RestDataSource ID:ds] @ ISC_DataBinding.js.jsf:16518:22
fireCallback(<no args: recursion>) on [Class RPCManager] @ ISC_Core.js.jsf:6805:36
fireCallback(<no args: recursion>) on [RPCManager ID:builtinApplication] @ ISC_Core.js.jsf:8653:32
fireReplyCallback(callback=>Obj, request=>Obj, response=>Obj, data=>Obj) on [Class RPCManager] @ ISC_DataBinding.js.jsf:41245:42
fireReplyCallbacks(request=>Obj, response=>Obj) on [Class RPCManager] @ ISC_DataBinding.js.jsf:41308:18
performOperationReply(request=>Obj, response=>Obj) on [Class RPCManager] @ ISC_DataBinding.js.jsf:41237:21
_performTransactionReply(transactionNum=>20) on [Class RPCManager] @ ISC_DataBinding.js.jsf:41151:18
fireCallback(<no args: recursion>) on [Class Timer] @ ISC_Core.js.jsf:6805:36
_fireTimeout(ID=>"_timeout180", tmrID=>435, delayedTmrID=>undef) on [Class Timer] @ ISC_Core.js.jsf:33271:10
<anonymous>() @ ISC_Core.js.jsf:33193:19
SmartClient version: v10.1p_2016-01-21
Comment