Problem with the Filter

Problem with the Filter

al_galileeal_galilee Posts: 1Questions: 0Answers: 0
edited August 2012 in General
hi all,

We have a filter on a field 'weight' (html select with serveral options like 1 kg, 10 kg, 25kg). When the users select '1 kg', the datatable return items which have 1 kg, 10 kg like weight.

Is it possible to filter strictly on the selected value?

Thanks,
Arnaud

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Yes - use regex filtering. To do that, unbind the default 'keyup' event that DataTables puts on the input element, and then bind your own call to fnFilter which uses something like `'^'+val+'$'` and enable the regex option to perform exact matching.

    Allan
This discussion has been closed.