How to add default fnServerParams ?

How to add default fnServerParams ?

dennysdennys Posts: 1Questions: 0Answers: 0
edited June 2012 in General
Hi Guys!

How can i add some default server params?


The code below add server params but is not for every call:

[code]

$(document).ready(function(){

$("#teste").dataTable({

"aoColumns" : [
{ "sTitle": "Id", "mDataProp": "id", "bSortable" : false, "bVisible": false },
{ "sTitle": "Nome", "mDataProp": "nome", "bSortable" : false },
{ "sTitle": "E-mail", "mDataProp": "email", "bSortable" : false }
],


"bServerSide": true,
"sAjaxSource": '/usuarios/paginar',
"fnServerParams": function ( aoData ) {

aoData.push( { "name": "pageRequest", "value": "test" } );

}
});

});

[/code]

i tried this code but does not work:

[code]
$.fn.dataTableExt.oApi.fnServerParams = function ( aoData )
{
aoData.push( { "name": "pageRequest", "value": "test" } );

}
[/code]



Thanks!!!

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    You can use $.fn.dataTable.defaults to set defaults - http://datatables.net/release-datatables/examples/advanced_init/defaults.html

    Allan
This discussion has been closed.