Data lost between front and DB

Data lost between front and DB

drodro Posts: 3Questions: 1Answers: 0

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 =, i) {
                                        if (columnOustandingDateDefinitions[i].search)
                                   = $.extend(true, {},, columnOustandingDateDefinitions[i].search);
                                        return item;
                                    data.columns = merged;
                                complete : function(json){
                                    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


  • allanallan Posts: 57,263Questions: 1Answers: 9,121 Site admin

    Can you show us the JSON response from the server please?


  • kthorngrenkthorngren Posts: 17,270Questions: 25Answers: 4,099

    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,. The createdRow callback is used to manipulate the display output of each row. Take a look at the onRowCreated function to see what it is doing.

    Let us know what you find.


  • drodro Posts: 3Questions: 1Answers: 0
    edited November 25

    @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's strange !
    I do this trick to resolve my problem but it's a little dirty^^

    Collection<Query> lQueries = mQueryDataTableDao.findPaginatedObjectByProtocol(lPaginatedQuery,
                        lPaginationCriteria.getPageNumber(), lPaginationCriteria.getPageSize());
                DataTableResponse<Query> lDataTableResponse = new DataTableResponse<Query>(lDataTableRequest);
                        mQueryDataTableDao.countAllObjectByProtocol(lDataTableRequest.getProtocolId(), Query.class, true));
                    for (Query lQuery : lQueries) {
                        // trick to resolve a display bug cause by othet entity relationship 
                        VisitType newVisitType = new VisitType();
                return lDataTableResponse;

    if i instance a new object with less entity relationship, it's ok !

  • allanallan Posts: 57,263Questions: 1Answers: 9,121 Site admin
    Answer ✓

    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!


  • drodro Posts: 3Questions: 1Answers: 0

    Thx for help ;)

Sign In or Register to comment.