0

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

1 Answer 1

1

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" } );
        }
    } );
} );
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.