When a databound grid fetches data from server and it contains \u2028 or \u2029 characters no data is displayed at all and a "The server failed to return a formatted response at all." warning message is displayed instead.
Tested in Feature Explorer [1] with isc.version "v11.1p_2017-09-05/AllModules Development Only".
Add the following code to javascript tab:
if (!isc.RPCManager.performTransactionReplyOrig) isc.RPCManager.performTransactionReplyOrig=isc.RPCManager.performTransactionReply
isc.RPCManager.performTransactionReply = function (transactionNum, results, wd) {
var r = results.responseText
// emulating a reponse including \u2028 character
if (r && isc.isA.String(r) && r.indexOf('United States') !== -1) {
console.log(results.response == results.responseText, arguments)
r = r.replace('United States','Modified:United \u2028 States')
Object.defineProperty(results, 'responseText', {
writable: true
})
Object.defineProperty(results, 'response', {
writable: true
})
results.responseText = r
results.response = r
}
return RPCManager.performTransactionReplyOrig(transactionNum, results, wd)
}
and click on "Fetch code:US" button -> no data is displayed in grid.
These special characters are not valid in JavaScript Strings (though they are in JSON), so they should be escaped in client side before trying to evaluate the response.
[1] https://www.smartclient.com/smartcli...crease=0&dhc=1
Tested in Feature Explorer [1] with isc.version "v11.1p_2017-09-05/AllModules Development Only".
Add the following code to javascript tab:
if (!isc.RPCManager.performTransactionReplyOrig) isc.RPCManager.performTransactionReplyOrig=isc.RPCManager.performTransactionReply
isc.RPCManager.performTransactionReply = function (transactionNum, results, wd) {
var r = results.responseText
// emulating a reponse including \u2028 character
if (r && isc.isA.String(r) && r.indexOf('United States') !== -1) {
console.log(results.response == results.responseText, arguments)
r = r.replace('United States','Modified:United \u2028 States')
Object.defineProperty(results, 'responseText', {
writable: true
})
Object.defineProperty(results, 'response', {
writable: true
})
results.responseText = r
results.response = r
}
return RPCManager.performTransactionReplyOrig(transactionNum, results, wd)
}
and click on "Fetch code:US" button -> no data is displayed in grid.
These special characters are not valid in JavaScript Strings (though they are in JSON), so they should be escaped in client side before trying to evaluate the response.
[1] https://www.smartclient.com/smartcli...crease=0&dhc=1
Comment