Search on column with collection of data

Search on column with collection of data

BusterenBusteren Posts: 52Questions: 17Answers: 4

Say I have a column with a list of values:

[{'name': 'first name'}, {'name': 'another name'}]

So I know I can display these combining the underlying data. However, when I want to search for the name data, this becomes a bit more tricky. I was thinking of doing something like this: to modify the search:
https://datatables.net/examples/plug-ins/range_filtering.html

But how can I get the regex datatables is using? Any pointers to how this can be solved are greatly appreciated!

Answers

  • BusterenBusteren Posts: 52Questions: 17Answers: 4

    So I figured it out! (have a bad tendency to be stuck on something, to post a question, then 5 minutes later figure it out):

    So when I know am searching a specific column, i add a custom search, then draw the table to update and the removes it:

    function searchSpecific(searchValue) {
        $.fn.dataTable.ext.search.push(
            function( settings, data, dataIndex ) {
                //evaluate
            }
         );
    
        table.columns(0).search(searchValue).draw();
        $.fn.dataTable.ext.search.pop();
    }
    
This discussion has been closed.