Editor - Changes to JSON structure after ugrading from 1.8.1 to 1.9.0
Editor - Changes to JSON structure after ugrading from 1.8.1 to 1.9.0
craiggriffin
Posts: 12Questions: 0Answers: 0
Hi,
After upgrading to 1.9.0, the returned POSTDATA json string is not being processed. Here is a stringified simple example (2 validation errors)
{"data":[],"fieldErrors":[{"name":"lpattgds","status":"Value must be entered."},{"name":"lpviewid","status":"Value must be entered."}],"error":""}
If I rollback to 1.8.1 , everything works okay and the errors are displayed, or the updated data is diplayed in the table.
Regards,
Craig.
This discussion has been closed.
Replies
Here is another example of a JSON object that is processed correctly in 1.8.1 , but fails to process in 1.9.0:
{
"data": [
{
"DT_RowId": 197,
"ucactcode": "A00002",
"ucactcded": "Review Exception5 6s352de",
"ucactnot": "Please review this exception and correct if necessary.notes",
"lw3shpurl": "http://www.lansa.com"
}
],
"fieldErrors": [],
"error": ""
}
Hi,
Thanks for posting this. I've not seen that problem I'm afraid - could you give me a link to your page so I can take a look and see what is going wrong?
Thanks,
Allan
Hi Allan,
Thank you for replying.
Unfortunately our development server is behind a firewall and the server processing is written using LANSA which requires licensing to port elsewhere. I will see if I can get a tunnel opened.
Is there some console.log statements I can insert in your JavaScript (dataTables.editor.js, editor.bootstrap.js) to troubleshoot in the meantime?
Regards,
Craig.
I'm not sure where to start is the problem - as this should be working .
Perhaps you can show me your Javascript for the Editor and DataTable initialisation?
Thanks,
Allan
I have set up a Global JS File with defaults:
Then for the specific object there is a js file:
And a specific HTML include:
This looks a little odd:
Its not using the data being submitted by Editor at all. That shouldn't stop a
success
callback though.In the
dataTables.editor.js
file if you find the line:and as the first line inside that function add a
console.log(xhr, text);
.Can you show me what that output is please?
Thanks,
Allan
Hi Allan ,
The Post is working for 1.8.1 and 1.9.0 . I use postData(action) to modify the JSON string for the LANSA expected format. Rows are being created/deleted/updated on the server in both versions.
Version 1.8.1 (working - displays errors in editor form) and 1.9.0 (not working. editor form closes and rows in table are not updated) have identical trace strings.
````
dataTables.editor.js
complete: [ function ( xhr, text ) {
// Use
complete
rather thansuccess
so that all status codes are// caught and can return valid JSON (useful when working with REST
// services).
trace('dte.js' + ': ' + xhr.responseText + ' - ' + text);
output:
dte.js: {"webroutine":{"context":{"action-request":"/CGI-BIN/lansaweb","dec-separator":".","images-path":"/images","iso-lang":"en","language":"ENG","partition":"UCP","service-name":"KWDTE01_wAction","session-key":"","session-key-method":"hidden","session-key-name":"_SESSIONKEY","technology-service":"LANSA:XHTML","user-id":"PCXUSER","webapplication":"KWDTE01","webapplication-title":"Workflow Action Code Maintenance","webroutine":"wAction","webroutine-title":""},"fields":{"W_ERROR":{"type":{"t":"H","l":8000},"value":""}},"lists":{"L_DATA":{"header":[{"name":"R_RRN","type":{"t":"I","l":8}},{"name":"UCACTCODE","type":{"t":"A","l":6}},{"name":"UCACTCDED","type":{"t":"A","l":30}},{"name":"UCACTNOT","type":{"t":"A","l":225}},{"name":"LW3SHPURL","type":{"t":"A","l":256}}],"entries":[]},"L_ERROR":{"header":[{"name":"R_FIELD","type":{"t":"H","l":10}},{"name":"R_ERROR","type":{"t":"H","l":1024}}],"entries":[["ucactcode","Value must be entered."],["ucactcded","Value must be entered."]]}}}} - success
In my JS.
gEditor.on('postSubmit', function (e, json, data, action, xhr) {
gElementFocus = false;
gPostSubmit = true;
var debug = true;
json = transformWebroutineData(action, json.webroutine);
gPostSubmit = false;
trace(JSON.stringify(json));
return json;
});
output:
{"fieldErrors":[{"name":"ucactcode","status":"Value must be entered."},{"name":"ucactcded","status":"Value must be entered."}],"data":[]}
```
I'm afraid I honestly don't know - I'd need to be able to debug it directly. Any luck with the tunnel?
Thanks,
Allan
Sorry Allan,
The IT guy is not going to open up a port for me .
I'll just stay with 1.8.1 until I can port an example for at a later stage.
Thank you for looking at this. BTW , I've been using DataTables extensively for years (image below of current application). Currently trying to get Editor adapted using a POC. 1.9.0 has some needed enhancements (Bootstrap 4 , Row Sorting , Upload ) .
Pretty busy right now, if I can get some time I'll install a local version and open a port into my local pc. For now , It looks pretty good with 1.8.1.
Kind Regards,
Craig.
That would be awesome - thanks. When you get a chance to set it up, drop me a PM by clicking my name above and then "Send message".
Allan