fnFilter wont search HTML entries

fnFilter wont search HTML entries

ZenCodeZenCode Posts: 1Questions: 0Answers: 0
edited August 2011 in Bug reports
I have datatables outputting a list of active and inactive items. To make things look nice and work easily I have the active field as a tinyInt and using a boolean/binary method of 0 and 1, inactive and active respectively. I'm then detecting the field name and instead of outputting 0 or 1 i'm replacing it with a div with a background image of a tick or a cross and just changing the class depending.

Now all of this works great until I want to search on it. I can sort them no problems, but searching for something like:
[code] [/code]
doesn't return the rows, all it does is show no results. I know my fnFilter code is working because searching something simple like a name or type etc comes up straight away.

Is anyone able to shed some light on why this wont work and if theres a way to get it to search.

BTW i need fnFilter to search all columns, not just one, but either way it still doesn't do whats needed.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    DataTables will automatically strip the HTML by default from a search string, but you can set the sType for the column to "string" to stop that from happening if you like. The down side is that you would be able to search for "div" and get a result... The answer to that is to have a custom filter ( http://datatables.net/development/filtering ) which pulls out only the information that you want from the string.

    Allan
This discussion has been closed.