Search function bugs
-
First of all: interesting plug-in and very useful for many people, I think. It should have much more attention (and downloads).
Anyway, I’m testing the search function and have a few comments, which may be some improvements. I’ve made some modifications to the wibergsweb.js file, but let me make clear that I’m not an expert in javascript.
The thing is that if you click on ‘Reset’ the full table displays, although I’ve set hidetable_load to “yes”. Therefor, I’ve added one line after line 35, so they now look like this:
tablewrapper_obj[0].outerHTML = response.tabledata; $('tr').hide();
If you now click on ‘Reset’ the table disappears. Maybe it’s even enough to just comment that line with ‘tablewrapper_obj’, possibly with an ‘if’ statement that checks whether you want a clean page on pageload?
Another thing is that a click on ‘Search’ with nothing filled in the searchbox also displays the full table. Not ideal. To check whether there’s a value in the search box (and what the length is), I’ve included an ‘if’ statement after line 65. It looks like this:
var search_text = $(this).parent().find('.search-text').val(); if (search_text.length < 5) { alert('Please enter a minimumn of 5 characters'); return false; } var h = $(this).data();
This checks if the search string is at least 5 characters, otherwise it will display an alert and abort the function. Can be any length of course. I suppose it could be further adjusted by checking for numbers only or letters only.
And lastly, there’s a thing I couldn’t find a solution for. If you search for anything that you are sure is not in the table, the ‘result’ is again the full table display. That’s of course not how search should be working. There should be a “Sorry, didn’t find anything” message. But apart from that I’m wondering why there even is a ‘result’, it should return nothing. Has this to do with what seems to be a ‘wildcard’ function in search?
Again, a very good plug-in and I hope you keep up the good work!
- The topic ‘Search function bugs’ is closed to new replies.