Search/filter finds matches in html tags

Search/filter finds matches in html tags

harvinderharvinder Posts: 2Questions: 0Answers: 0
edited April 2009 in General
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

Replies

  • allanallan Posts: 61,916Questions: 1Answers: 10,149 Site admin
    Hi Harvinder,

    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
  • harvinderharvinder Posts: 2Questions: 0Answers: 0
    Thank you very much! This worked out quite nicely.

    Harvinder
  • jbschradesjbschrades Posts: 1Questions: 0Answers: 0
    I'm running version 1.9 and I have some tags in my table that are getting picked up on searches. I also have some link tags in the table. These are not getting picked up in search. Any ideas?

    Thanks.

    Jeff
  • t1589t1589 Posts: 5Questions: 0Answers: 0
    I have a same kind (version 1.9.3) of problem. I have a link in one column in the table and html tags are found in asDataSearch content (picked up in searches). I have also static html page (demo) in which this problem does not occur. Column sType is html in both tables. I have uploaded data to debugger:
    "real" table:
    http://debug.datatables.net/idazab

    demo table:
    http://debug.datatables.net/anecor

    Any ideas anyone???

    Teemu
  • allanallan Posts: 61,916Questions: 1Answers: 10,149 Site admin
    Unfortunately I think this is a regression in DataTables. I'll look into a fix.

    Allan
  • t1589t1589 Posts: 5Questions: 0Answers: 0
    Hi

    Any progress on this one?

    Teemu
  • allanallan Posts: 61,916Questions: 1Answers: 10,149 Site admin
    Sorry - haven't had time to check into it yet. Hope to do so soon, just can't say for certain when with everything that is going on. If anyone else wants to fix the issue and send a pull request, it would be most welcome!

    Allan
  • hundmanihundmani Posts: 2Questions: 0Answers: 0
    edited October 2012
    Hi,

    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
  • hundmanihundmani Posts: 2Questions: 0Answers: 0
    Bumping for importance
  • allanallan Posts: 61,916Questions: 1Answers: 10,149 Site admin
    This is the commit that broke this feature: https://github.com/DataTables/DataTables/commit/d034d187bde9475edd0e15d758368032ec4bf814 . Not particularly successful and I'm somewhat annoyed my unit tests didn't pick it up (I'll add new tests). Unfortunately fixing it while keeping the benefits of the commit above is not entirely trivial - I'm still looking into the best way to fix this.

    Allan
  • allanallan Posts: 61,916Questions: 1Answers: 10,149 Site admin
    And this commit fixes it: https://github.com/DataTables/DataTables/commit/065c2cc66b872c6964b7d31f12941f23e7f1f171 .

    Allan
  • ArkkimaagiArkkimaagi Posts: 4Questions: 0Answers: 0
    This fix does not work as far as I understand how this code works.

    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.
  • ArkkimaagiArkkimaagi Posts: 4Questions: 0Answers: 0
    edited February 2013
    How about this?
    [code]
    var skip=0;
    for ( var i=0, len=aData.length ; i
This discussion has been closed.