Filtering on datatable not always working, sometimes takes 5 letters before the filter happens

Filtering on datatable not always working, sometimes takes 5 letters before the filter happens

pikuchanpikuchan Posts: 3Questions: 0Answers: 0
edited February 2013 in General
I am having some issues with the filtering of my data and cannot quite figure out what is happening. The problem is spanning across 10's of pages and is becoming a bit of a problem. For example, I have a datatable and type a 'j' into the filter box. It will filter down to 2 records as it should. I put a 't' in and it does not filter down to anything. There are plenty of rows that do not have a 't' in them, but it doesn't filter. It really seems to dislike 'test'. I entered two records that have a primary key of testing1 and testing2. When I type in test, nothing happens. As soon as I type in 'testi' it will filter down to the two rows.

Has anyone else seen similar issues?

Replies

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    Can you link to a test case please: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
  • pikuchanpikuchan Posts: 3Questions: 0Answers: 0
    Here is a jsFiddle that demonstrates the problem http://jsfiddle.net/y467w/
    If we pull out the details row, it works fine. If you look at the sDefaultContent for the "+" button, it is using this as a filter. In our case, we had "test" as part of the url for the image path. Therefore, if we typed test into our filter box, it would not filter out any data until we typed in "test" + 1 character. The same is true with the jsFiddle using your image path to the "+" button. In that example, try to filter on "d", nothing will happen. Then filter on "j", which is not in the sDefaultContent, and it will filter immediately.
  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    I see - this is unfortunately a known issue in 1.9.4 (introduced in 1.9.4, 1.9.3 didn't have this problem and it is fixed in git now for release in 1.10). The issue is that DataTables is not stripping the HTML from the first column automatically. You could use the latest version from git, or add `bSearchable:false` to your first column: http://datatables.net/forums/discussion/14292

    Allan
  • pikuchanpikuchan Posts: 3Questions: 0Answers: 0
    Thanks Allan. The bSearchable:false did the trick.
This discussion has been closed.