Data lost between front and DB
Data lost between front and DB
I've a list of queries in DB with two types who fill two datatables. In the second one, i've some visits link by a fk_visit_id to a visit table and some visitType link by a fk_visit_type_id to a visitType table, the both table have some fk too.
When i call my ajax to fill my second datatable like this :
var options = {
name : "queriesOustandingDate",
language : {
"infoFiltered": ""
},
paging : true,
lengthChange : true,
paginationType : "full_numbers",
columnsSearching : true,
serverSide: true,
createdRow: onRowCreated,
ajax : {
url : "../services/supervision/queries/oustandingDate/list?protocolId=" + mProtocolId,
data: function(data, settings) {
// Add data when request is sent to the API
const merged = data.columns.map(function(item, i) {
if (columnOustandingDateDefinitions[i].search)
item.search = $.extend(true, {}, item.search, columnOustandingDateDefinitions[i].search);
return item;
});
data.columns = merged;
},
complete : function(json){
listOfQueries=json.responseJSON.data;
console.log("---------------- listOfQueries Oustanding -----------------", listOfQueries);
}
},
columns : columnOustandingDateDefinitions,
order : [ [ 9, 'asc' ], [ 8, 'asc' ] ]
};
queriesOustandingDateTable = new RawDataTable(options);
}
My datatable is fill like this and you can see the column Visit Type empty but i've some info in DB !!! :
And if i modify the sorting by Subject for example, some Visit Type are displayed !!!
Thx all !
This question has an accepted answers - jump to answer
Answers
Can you show us the JSON response from the server please?
Allan
Use the browser's network inspector tool to see what is in the JSON response for the XHR request. Verify there is data for the Visit Type column.
You have
createdRow: onRowCreated,
. ThecreatedRow
callback is used to manipulate the display output of each row. Take a look at theonRowCreated
function to see what it is doing.Let us know what you find.
Kevin
@allan : In my json, my VisitType object is null !
@kthorngren : My onRowCreated just add some attr with id row by row !
My return in my controller is ok, the object VisitType is complete but i lost my visitType between the DataTableResponse in my java and the return of ajax call...it's strange !
I do this trick to resolve my problem but it's a little dirty^^
if i instance a new object with less entity relationship, it's ok !
I'm afraid that server-side support in Java is outside my range of competence. You'd need to ask on StackOverflow or a Java specific support forum.
Good to know you've got a workaround though!
Allan
Thx for help