Thursday 19 June 2014

jquery datatables pass server parameters

  $('#tbldetail').dataTable({
                "aLengthMenu": [[10, 25, 50,100, -1], [10, 25, 50,100,"All"]],
                "bFilter": false,
                "bProcessing":true,
                "bServerSide":true,
                "bDestroy": true,
                "bSort": false,
                "sAjaxSource":'/detail',
                "fnServerParams":function (aoData) {

                   aoData.push({"name":"starttime1","value":searchdata.starttime1});
                   aoData.push({"name":"starttime2","value":searchdata.starttime2});
           
                 
                },
                "aoColumnDefs": [
                                 { "sType": "date", "aTargets":[0]},
                                 { "sWidth": "60px", "aTargets":[1] }
                               
                ],
                "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
             
                   
                 },
                "columns":[
                    { "data":"starttime1"},
                    { "data":"starttime2" }
                ]
           });