Searching for booleans (not working?!)

Searching for booleans (not working?!)

datacollectdatacollect Posts: 6Questions: 4Answers: 0
edited June 2015 in Bug reports

Hi,

I'm trying to search a column (local no server-side) for boolean values (no strings).

mergedDevicesListDataTable
  .column( 0 )
  .search( true )
  .draw();

It always returns an empty result set.
Searching the boolean column by string ("true"/"false") is not working either.
Searching other (non-boolean) columns in the same table is working perfectly.
Any idea?

Thanks.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Searching for 'true' should work - I've just created this little example to show it working. If you are using server-side processing, it won't work since the filtering is done at the server-side.

    The reason it needs to be a string for the default filter is that DataTables converts the filtering values to be strings. This is a limitation in the current code base that I plan to resolve in the next major release.

    You could use a custom plug-in filter if you do need to search for boolean true.

    Allan

  • datacollectdatacollect Posts: 6Questions: 4Answers: 0

    Ok. Got it now.
    I am rendering the booleans to a custom string (using columns.render) and didn't constrained it to "type == 'display'". This was new to me.
    Thank you for your answer.

This discussion has been closed.