Search/filter finds matches in html tags
Search/filter finds matches in html tags
Hello, I have a table in which a couple of the colums contain links (a href). When I do a search, it finds matches within the tags. Is there any way to disable searching within html tags?
Otherwise this is an awesome script!
Harvinder
Otherwise this is an awesome script!
Harvinder
This discussion has been closed.
Replies
This certainly is possible - have a look at this example: http://datatables.net/examples/example_html_sort.html
The key is to set the column type to "html". Then HTML tags will be stripped from the search.
Regards,
Allan
Harvinder
Thanks.
Jeff
"real" table:
http://debug.datatables.net/idazab
demo table:
http://debug.datatables.net/anecor
Any ideas anyone???
Teemu
Allan
Any progress on this one?
Teemu
Allan
There seems to be pretty wide bug, since the filtering doesn't work on your demo page either at http://datatables.net/examples/advanced_init/html_sort.html
I checked the sType settings with Chrome, and indeed the second column is set to html, yet the filtering does not work, both seen in screenshot: http://imgur.com/kAx4D
Regards,
Ville
EDIT:
I've so far found out that the problems come with datatables version 1.9.3. Everything's fine with earlier versions, such as 1.9.2.
EDIT 2:
I've found the error. It seems there's missing crucial code from function _fnBuildSearchRow.
Here's the function for 1.9.2:
[code]
function _fnBuildSearchRow( oSettings, aData )
{
var sSearch = '';
if ( oSettings.__nTmpFilter === undefined )
{
oSettings.__nTmpFilter = document.createElement('div');
}
var nTmp = oSettings.__nTmpFilter;
for ( var j=0, jLen=oSettings.aoColumns.length ; j
Allan
Allan
The aData is not full dataset. I get an aData.length as 10 and oSettings.aoColumns.length 12 as I have excluded 2 columns from the search. This makes the search use wrong sType on my columns after the filtered ones.
[code]
var skip=0;
for ( var i=0, len=aData.length ; i