Search box does not work with input fields in the table?

Search box does not work with input fields in the table?

ashmanashman Posts: 6Questions: 0Answers: 0
edited July 2013 in General
Hi All,
I have a table which contains a combination of text and input fields. The search box however only successfully filters the cells containing text, and not the cells containing text in input fields.

Can anyone guide me in the right direction?

Thanks!

Replies

  • allanallan Posts: 63,501Questions: 1Answers: 10,471 Site admin
    Not directly - because the value of the input field is a property, not in the HTML which is what DataTables sees. It is possible to use a custom filter to do it though: http://datatables.net/development/filtering (see the "Custom row filters" section).

    Allan
  • ashmanashman Posts: 6Questions: 0Answers: 0
    Hi Allan,

    Thanks for that...yes I had looked at this option, and this is fine when you have the same type in your column (e.g. input fields only). But when you have a mixed type in the same column (e.g. one row has a text value, the next row an input field etc.), then it gets a bit complicated? The filter works on row data, so you would have to go through every array element and inspect its type, before returning the appropriate values...am I right?
  • allanallan Posts: 63,501Questions: 1Answers: 10,471 Site admin
    Yes - that sounds about right to me. As you say, its a bit complicated. That in combination with the fact that it isn't used that often is why it isn't in the DataTables core!

    Allan
This discussion has been closed.