How to do custom filtering with Datatables and server-side processing

前端 未结 5 1711
面向向阳花
面向向阳花 2021-02-02 17:30

I am using Datatables to display tabular data in my Web application, and have configured it to make use of server-side processing, i.e. query the server via AJAX for filtered da

5条回答
  •  心在旅途
    2021-02-02 18:13

    This worked for me

    $(document).ready(function() {
         table = $('#okmorders').DataTable( {
            // "ajax": 'http://cdpaha2.dev/admin/organizations/okm_orders'
    				serverSide: true,
    				"paging":   true,
    				"searching":  false ,
            // "info":     false,
            "bLengthChange": false,
            // "iDisplayLength":50,
            // "aaSorting": [],
            // "oLanguage": { "sEmptyTable": "No orders present " } ,
            "aoColumnDefs" : [
              { 'bSortable' : false, 'aTargets' : [ 6 ]}
    				],
    
    			// 	"fnServerParams": function (aoData) {
    			// 		 aoData.push({name: "includeUsuallyIgnored"});
    			//  },
    				ajax: {
    		        url: 'yoururl.json' ,
    		        type: 'POST',
    						data:
    						{
    							'startDate':function(){return $("#startDate").val(); },
    							'endDate': function(){return $("#endDate").val(); } ,
    							'placedBy':function(){return $("#placedBy").val(); },
    							'customer_po': function(){return $("#customer_po").val(); } ,
    							'customer_ref': function(){return $("#customer_ref").val(); }
    						}
        },
        } );

提交回复
热议问题