darrachequesne / spring-data-jpa-datatables

Spring Data JPA extension to work with the great jQuery plugin DataTables (https://datatables.net/)
Apache License 2.0
441 stars 174 forks source link

DataTables warning: table id=employees - Requested unknown parameter #88

Closed Mike-the-one closed 5 years ago

Mike-the-one commented 5 years ago

i followed the sample, here is my html:

<table id="employees" class="table">
                      <thead>
                        <tr>

                          <th>orderNumber</th>
                          <th>name</th>
                        </tr>
                      </thead>
                    </table>

and my js:

$('table#employees').DataTable({
            ajax: {url: '/data/orders', method: 'GET', data: master.flatten },
            serverSide: true,
            columns: [

                {
                    data: 'orderID'
                },
                {
                    data: 'channel.name'
                }
            ]
        });

And i used the flatten method to fix the serialization issue. Here is the error I got:

DataTables warning: table id=employees - Requested unknown parameter 'orderID' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4

I can see the client (browser) received the correct number of rows (I see pages), but the table doesn't render, just empty rows (10 per page).

Please help

Mike-the-one commented 5 years ago

with jsonview on the controller, the data returned is empty:

``sh {draw: 1, recordsTotal: 656, recordsFiltered: 614, data: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}],…}



If I remove jsonView, then all fields are returned.

thanks
Mike-the-one commented 5 years ago

nvm, I figured out, I forgot to add jsonview on the entity fields!