Is it possible to use exact match for filtering

Is it possible to use exact match for filtering

AndrejSorojAndrejSoroj Posts: 2Questions: 0Answers: 0
edited April 2014 in General
I need to use exact match while filtering i.e. if I have next table

ABC Corp | 123
BBB Inc | 234
CCC ABC Corp | 345

and put to search input 'ABC Corp', I want to see only first row.

Is it possible to configure datatables to do such filtering WITHOUT hacking datatables sources.

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    Search the forum. There are plenty of posts about this.
  • AndrejSorojAndrejSoroj Posts: 2Questions: 0Answers: 0
    You are right a lot of discussions here but in most of them proposing to use fnFilter(Api function) i.e. create our own textbox and assign an event to it(e.g. keyPress) and in callback call fnFilter. But that way doesn't suit me. I want to use built-in textbox(appears if using "bFilter: true" in config). "oSearch" options also doesn't allow to do exact match.

    Another proposed way I found is to modify next code in sources

    [code]
    $.extend( oSettings.aoPreSearchCols[ iColumn ], {
    "sSearch": sInput+"",
    "bRegex": bRegex,
    "bSmart": bSmart,
    "bCaseInsensitive": bCaseInsensitive
    } );
    [/code]

    But it's hacking.

    So, still can't find the way to use exact matching without source hacking or using external textbox.
  • allanallan Posts: 63,230Questions: 1Answers: 10,416 Site admin
    If you want a "proper" way of doing it, create a new feature extension that creates an input box which calls fnFilter as you require. That's not hacking, that extending. DataTables itself can't provide every option - otherwise the library would be massive. That is why I'm made it extendable and why the API is as complete as it is.

    Allan
This discussion has been closed.