I have a really simple Datatable configuration,
$("#providerTable").dataTable({
"bLengthChange":false,
"bAutoWidth":false,
"bProcessing": true,
"bServerSide":true,
"sAjaxSource":"${createLink(controller: 'authorization', action: 'fetchProvider')}" ,
"bInfo": true,
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "more_data", "value": "my_value" } );
},
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
return ("Showing " + iStart +" to "+ iEnd + " of " + iTotal);
}
});
Everything is working fine except that the variable more_data that should have been passed to the server is not passed. I’m using Grails at the server side and a quick parameter dump from the Ajax request gives the following result:
wrappedMap=[iSortCol_0:0, sSearch_2:, bRegex:false, sSearch_3:, sSearch_0:, sSearch_1:, sSearch:, iSortingCols:1, mDataProp_0:0, mDataProp_1:1, mDataProp_2:2, mDataProp_3:3, mDataProp_4:4, bSortable_2:true, bSortable_1:true, bSortable_4:true, bSortable_3:true, bSortable_0:true, sColumns:, iColumns:5, _:1347175565036, sSearch_4:, bRegex_2:false, bSearchable_2:true, bSearchable_1:true, bRegex_3:false, bSearchable_0:true, bRegex_4:false, sSortDir_0:asc, iDisplayStart:0, iDisplayLength:10, sEcho:1, bSearchable_4:true, bRegex_0:false, bSearchable_3:true, bRegex_1:false, action:fetchProvider, controller:authorization]
see, there’s no sign of the variable named more_data. All other default Datatable variables along with the controller and action name are being passed except for the more_data variable. What mistake could I be making here?
Thanks
Question about fnServerParams
upgrade to a 1.8.2 or later in order to use the
fnServerParams