How to use the datatable with server side search and filter

How to use the datatable with server side search and filter

msammsam Posts: 4Questions: 0Answers: 0

i tried it using the example on https://datatables.net/examples/server_side/simple.html
but didn't find the file require( 'ssp.class.php' ); which is under the server-side script tab.
If someone have the updated code of server side individual search and filter code please share it..
i also check the code from here: https://datatables.net/examples/server_side/server_side.html
which is also for some older version.
Please Help

Replies

  • msammsam Posts: 4Questions: 0Answers: 0

    i tried using this file which i was using with earlier version of datatable.
    can you please help me edit my file so that it works with 1.10.13
    i am attaching my server-script and js
    please help

    below is my js code

      'use strict';
    $(document).ready(function() {      
         $('#advanced-table tfoot th').each( function () {
            var title = $(this).text();
            $(this).html( '<div class="md-input-wrapper"><input type="text" class="md-form-control" placeholder="Search '+title+'" /></div>' );
        } );
        
          var advance = $('#advanced-table').DataTable( {
              
          dom: 'Bfrtip',
          buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
          ],
            "processing": true,
            "serverSide": true,     
            "ajax": "processes/getlistcustomer.php",
              "aoColumns": [
                { "bSortable": false, "bSearchable": false},
                { "bSortable": false, "bSearchable": true},                                        
                { "bSortable": false, "bSearchable": true}, 
                { "bSortable": false, "bSearchable": true}, 
                { "bSortable": false, "bSearchable": true },                                        
                { "bSortable": false, "bSearchable": true }
                                    ],
              initComplete:function() {
                  var api = this.api();
                  
                // Apply the search
                api.columns().every( function () {
                    var that = this;
    
                    $( 'input', this.footer() ).on( 'keyup change', function () {
                        if ( that.search() !== this.value ) {
                            that
                                .search( this.value )
                                .draw();
                        }
                    } );
                });
              }
        } ); 
    } );
    
  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    The best is to go the DataTables CDN and download the appropriate version there.

    Cheers,

    Colin

This discussion has been closed.