javascriptdatatabletabulatorcfml

Tabulator Global Search Across Multiple Columns


We've moved, on one of our pages, from using a datatable to using tabulator.

We have a 'global search input' at the top of the page which currently searches the datatable on the page, where if a like match is made in any column, it redraws the table.

I'm trying to achieve the same in tabulator, however, when I add the second column and the OR statement, the table show's blank on enter.

Removing the second field, 'uniqueID' the search works on the event title as before.

Any help in getting this so, if the search shows the rows if ANY of the columns match in a like state?

 var opt = $('#cf_header_search_option').val(); 

 if (opt == 'grid') {
  if (type !== 'tabulator') {
   cfHeader_searchDataGrid ( dataTable );
  } else {

   var searchValue = $('#header_search_query').val().trim().toLowerCase();
   table.setFilter([
    { field: 'event_title', headerFilter: true, type: 'like', value: searchValue },
    { field: 'uniqueID', headerFilter: true, type: 'like', value: searchValue },
                   ]);
  }
 } else {
  $('#cf_header_search_form').submit();
  return true;
 }          
}

Solution

  • Solution was the put a [] on the setfilter.

    table.setFilter([[
                      { field: 'event_title', headerFilter: true, type: 'like', value: searchValue },
                      { field: 'uniqueID', headerFilter: true, type: 'like', value: searchValue },
                   ]]);