Global search and column search not functioning correctly in serverside (DRF)

Global search and column search not functioning correctly in serverside (DRF)

MixoMixo Posts: 3Questions: 1Answers: 0
edited February 2019 in Free community support

Hi,
I am using datatables with server-side processing (django rest framework).
Each column of the datatatables has its "column search" and they work properly. If I use the global search too, they doesn't work! The search is carried out only by the global search.
The problem doesn't exist if I disable the "server side" (serverSide: false)
Have you any suggestions please?

initComplete: function () {
 // Restore state
    var state = table.state.loaded();
    if ( state ) {
      table.columns().eq( 0 ).each( function ( colIdx ) {
        var colSearch = state.columns[colIdx].search;
        if ( colSearch.search ) {
          $( 'input', table.column( colIdx ).footer() ).val( colSearch.search ); }
      } );
    };
 // Apply the search
 table.columns().every( function () {
    var that = this;        
        $( 'input', this.footer() ).on( 'keyup change', function () {
            if ( that.search() !== this.value ) {
                    that.search( this.value ).draw();
            }
        } );
    } );
}//initComplete

Replies

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736

    If I use the global search too, they doesn't work! The search is carried out only by the global search.

    Since you are using server side processing the search is performed by your Django framework. You would need to look into that code to see why it is not handling the combination for column and global searches.

    Kevin

  • MixoMixo Posts: 3Questions: 1Answers: 0

    Ok thank you!
    I try to find something about docu or example

This discussion has been closed.