omitting rather than include the matching results from search in datatable

Viewed 40

For example - if you type “hello” into the name search field, only results that DO NOT INCLUDE “hello” in the name will appear in the results in data table

Need a 2 check box

  1. To enable/disable Regular expression
  2. To omitting rather than include the matching results

below need code in if statement

var table = $('#example').Datatable()

$('#example thead tr:eq(1) th').each( function (i) {

  $( 'input', this ).on( 'keyup change', function () {

     if ( table.column(i).search() !== this.value ) {

       // for regular exppression
       if ($('#chk_'+i).prop('checked') == true) { 
          reg_exp = true
          smart_search = false
       }
       else {
          smart_search = true
          reg_exp = false
       }
       // for 
       if ($('#not_equal_'+i).prop('checked') == true) {
          table.draw();
       }
       else {
         table
         .column(i)
         .search( $('#text_box'+i).val(),reg_exp,smart_search )
         .draw()
       }
     }
  });
}

Hope that you understood my problem.

0 Answers
Related