Changing the way search() works for specific columns

Changing the way search() works for specific columns

maazalimaazali Posts: 3Questions: 2Answers: 0

I've added search functionality to all columns from this example https://datatables.net/examples/api/multi_filter.html

As you can see it has a search(this.value) in the function. The issue is I have columns that have a select box. I want to be able to customize the search() method for those specific columns to try to match the this.value with the selected value in the select box.

How would I go about doing that? Is there a global way to edit a columns search functionality? Meaning the global search will also take that into account when searching.

I see some columns documentation here: http://legacy.datatables.net/usage/columns but it's in legacy so I am not sure if that's the right api to use for current data tables.

If someone can come up with a little code snipped for implementation, that would be great!

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    You would need to use a custom filter in order to do live DOM sorting. DataTables caches the data for filtering in order to improve performance - hence the need for a custom filter.

    I've still to update the documentation for custom filtering in DataTables 1.10, but the old documentation is still valid: http://legacy.datatables.net/development/filtering#row_filters .

    Regards,
    Allan

This discussion has been closed.