0

I am using the below code to filter the record from jquery data table.My data table format like this

 var aDataSet = [['1', 'GOld', 'G-110,G-112,G-123', 'G1-001,G1-005,G1-008'],
                ['2', 'GOld type 1', 'G1-001,G1-003,G-123', 'G-110,G-112,G-156']];


 $(document).ready(function () {
                oTable = $('#example').dataTable();
                oTable.fnFilter('G-110,G-112');
            });

Suppose i give the input value like 'G-110,G-112' to the above function means the out put like this

The above two records are displayed.

Suppose my input is G1-001,G1-003,G-156 means the second record only displayed.

I want to filter the most of the item present in the data table row.

user1951007
  • 235
  • 1
  • 11
  • 19

1 Answers1

0

you have to include check for the regexp in fnFilter function:

fnFilter function has these elements as parameters:

  • {string}: String to filter the row on
  • {int|null}: Column to limit filtering to
  • {bool} [default=false]: Treat as regular expression or not
  • {bool} [default=true]: Perform smart filtering or not
  • {bool} [default=true]: Show the input global filter in it's input box(es)
  • {bool} [default=true]: Do case-insensitive matching (true) or not (false)

so your filter function should look like this:

oTable.fnFilter('G-110,G-112',null,true); 
//this will check your row based on regular expression also.
sourcecode
  • 1,802
  • 2
  • 15
  • 17