Searching across multiple columns not working
Searching across multiple columns not working
Hi folks
I have an app that I am updating to work with 1.10.1. Prior to this I was using 1.10_WIP version
Prior to upgrading to 1.10.1 I had a working multi-column search using 1.10_WIP
http://forum.arcanewonders.com/sbb/database.php
If you select "Equipment" and "Dark" from the drop-down menus you can see that there are 12 items
Using the same data set but the 1.10.1 code and the result is 5 items and not 12.
The code I was using previously was listTable.fnFilter( this.value, thisColumn)
I thought that the issue might be that In wasn't using the API calls with 1.10.1 so I changed the code to be
listTable.DataTable().column(thisColumn).search( this.value ).draw()
This still results in the same 5 items being shown instead of 12.
Is this a bug or, more likely, do I need to code multi-column searches differently using 1.10.1?
TIA
This question has an accepted answers - jump to answer
Answers
I think I have run into a bug or the issue is much stranger than I thought.
If you check out
http://forum.arcanewonders.com/sbb/database_test.php
and use the "Search Name" column to search for "Bloodfire Helmet" you can see that the entry is there and that it is a 'Dark" school entry.
If you use the School dropdown in the footer and set it to Dark you will see that Bloodfire Helmet is not listed.
The problem appears to be that there is no entry in the Subtype column for Bloodfire Helmet. If I manually edit the data source to add one (anything really) then it will show up in searches again.
So it appears that between 1.10_WIP and 1.10.1 there was an issue introduced that is stopping searches working if fields in the row are blank
I also managed to replicate the issue using the code from one of the API examples
http://datatables.net/examples/api/multi_filter_select.html
If you use this Fiddle, I've changed the Suki Burks entry so that she doesn't have a city. If you do a search for her age (52) she doesn't show up in the search results. If you replace the city she does.
http://jsfiddle.net/KU8aR/
It appears to only be when there is a missing cell in a column preceding the one that you are searching on. So if you search for Developer she appears but searching for her age will not show her.
Hi,
Thanks for the error report and test case. This has actually been fixed in the nightly already - updated test case: http://jsfiddle.net/KU8aR/1/ .
The nightly is available on the downloads page and I'm going to release it quite soon, as this is a nasty little bug.
Allan
Thanks Allan. I'll download the nightly build and test it later today
Works perfectly. Thanks