Next, the new feature of ableable1.10 in the previous article. For work requirements, We Need To paging the server.
I still take the Code directly .. Add comments to the code .. If you have any questions, give me some advice...
$ (Document). Ready (function (){
VaR table = $ ('# example'). datatable ({
"Columns": _ tablecols,
"Createdrow": xxxxxx, // function name
"Processing": True, // when the data is not fully loaded at once, the page displays loading in progress.
"Serverside": True, // if it is set to true, the server page is displayed.
"Pagingtype": "full_numbers", // display form of the paging button
"Paging": True, // if it is false, all data is displayed on a page.
"Ajax ":{
"Url": "xxxx/query ",
"Type": 'post ',
"Data": function (d ){
D. orderby = "position ";
},
"Datasrc": function (JSON ){
Return JSON. records;
},
},
});
});
// The above JS Code is all written. If you need to add other attributes, such as lengthmenu, etc... See the server side processing URL for: http://datatables.net/manual/server-side
I use the springmvc framework. Therefore, the returned object must contain the recordsfiltered and recordstotal long integer parameters. Otherwise, an error is reported (for example, the number of showing 1 to 10 of 57 entries is Nan ). For more information, see the JSON data source on the official website. Therefore, the returned object should contain two parameters.
// Recordsfiltered is the total number of records in the data set after filtering
Private long recordsfiltered = 0;
// Total number
Private long recordstotal = 0;
If you have any questions, please leave a message ....
Datatable1.10 server disconnection page