I have a jQuery dataTable initialized from jSON and mapped by Spring
Currently, I do not pass any parameter and retrieve all information, but I need to pass one String to the Java method, probably through a request parameter.
What is best method of doing this?
The front-end code:
table = $("#retrievedTable").dataTable({
"bServerSide" : true,
"sAjaxSource" : "/cm/credit/getretrievedTable.json",
"bProcessing" : true,
"sPaginationType" : "full_numbers",
"bRetrieve" : true,
"bDestroy" : true,
"bAutoWidth": false,
"bLengthChange": false,
"iDisplayLength": 20,
"aoColumnDefs": [{
"mRender": function ( data, type, row ) {
return moment(data).format("MM/DD/YYYY");
},
"aTargets": [ 0 ]
}]
});
The server-side code:
@RequestMapping(value = "/getretrievedTable.json")
public void getTable(HttpServletRequest req, HttpServletResponse resp, Model model) throws IOException
http://www.datatables.net/release-datatables/examples/server_side/custom_vars.html
fnServerParams
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/server_processing.php",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "more_data", "value": "my_value" } );
}
} );
} );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.