No matching records found
No matching records found
Good afternoon guys. I'm developing a web app using Spring MVC; basically, i must query a db for some data and show them into html table, updating the div elements of the home page. Thedata are returned from Controller as Json using the Jackson framework.
I'm using DataTables to show results but i got this discussion title message.
This is my code about the use of Data Table:
```
$(document).ready(function() { $('#firewalldata').dataTable( { "processing": true, "serverSide": true, "ajax":{ url: "../getfirewall.json", type: "post", dataSrc: '' }, "columns": [ { "data": "id" }, { "data": "ip" }, { "data": "info" }, { "data": "name" } ] } ); } );```
The url of Ajax section is the same of my Spring controller; i've tried to format Json data with bost serialize() and serializeArray().
Thank you in advance for response and if you need my other code, tell me and i'll provide it.
This question has accepted answers - jump to:
Answers
dataSrc should not be "". You should be returning more than an array of objects.
Setting dataSrc:"" means that you are returning just an array. You need to return some other values as well to ensure paging, page information, etc works right.
take a look at https://datatables.net/manual/server-side
I can only guess that
getfirewall.json
is not returning an array of data for DataTables to read.I note you have enabled the
serverSide
option. Do you really want server-side processing? That will require dynamic processing on the server and I'm assuming that the .json is a static file. I'd suggest you remove that.If you did mean for it to be there, it is worth noting that it is incompatible with
ajax.dataSrc
being an empty string like you have. See the manual for server-side processing requirements.Allan
First of all, thanks both you for yours answer. I apologize for my errors but i'm using the plugin from 3 days and i'm not yet well "formed".
Monday i will try your suggest to work; thanks again and have a good we.