Refreshing DataTable After Ajax Call

Refreshing DataTable After Ajax Call

hemant_joshihemant_joshi Posts: 13Questions: 7Answers: 0

I have gone through number of threads and discussion but very unclear regarding refreshing Datatable which gets data from server side and refreshes the DataTable.

Can I simple use  table.ajax.reload( null, false );

where my paging will be retaind and it will go back to server and get fresh data. Any help would be wellcome.

Answers

  • jrizzi1jrizzi1 Posts: 44Questions: 12Answers: 3
  • hemant_joshihemant_joshi Posts: 13Questions: 7Answers: 0

    Will that work with server side processing.

  • jrizzi1jrizzi1 Posts: 44Questions: 12Answers: 3

    yup, thats what i use for server-side processing

  • hemant_joshihemant_joshi Posts: 13Questions: 7Answers: 0

    Sorry it give me error draw() is not a function.

  • jrizzi1jrizzi1 Posts: 44Questions: 12Answers: 3
    edited May 2015

    you will need to setup your source code example to properly diagnose the issue
    here is a server-side template
    http://live.datatables.net/laxinabe/1/edit

    how i use is like so, having filters in the header (note i have omitted the code that generates the filters for brevity)

    var table;
    $(document).ready( function () {
      table= $('#myTable').DataTable();
    
    table.columns().eq( 0 ).each( function ( colIdx ) {
        $( 'input', table.column( colIdx ).header() ).on( 'keyup change', function () {
            table
                .column( colIdx )
                .search( this.value )
                .draw(); //<--here is the draw
        } );
    } );
    
    } );
    
  • jrizzi1jrizzi1 Posts: 44Questions: 12Answers: 3

    and i do apologize i do use table.ajax.reload( null, false ); when i am not filtering, and it refreshes my data with current filters and pagination

This discussion has been closed.