-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filter_searchDelay not working v2.27.8 and how to limit minimum characters #1299
Comments
Just ran into the same problem in v2.27.7, going to try a patch |
The problem seems to be line 3996-3998 of jquery.tablesorter.combined.js:
So if liveSearch is true, it sets the timeout to the search delay and if liveSearch is false it sets it to 10ms. I believe it should be the opposite. If liveSearch is true, it should be 10ms and if liveSearch is false it should be set to filter_searchDelay. I swapped the 2 and it's working for me. |
I don't think so, i want live search, if it is true (default one) it should let me set the delay. So this code looks good, i really don't see where is the problem. I wanted to check also if any another input character is resetting the delay from start, but due to this error, i can't check it. |
I'm going to try and look into this tomorrow guys, just been busy rebuilding my system the last 2 days. and today is turkey dinner so I can't miss that ;) |
I updated the question to also know how to limit the minimum characters to search. |
Thanks for looking into it. I guess I was confused on the terms used. I was thinking "live search" meant that it would search instantly as you typed, and that turning on a search delay implied you were disabling live search. But reading the docs again I can see it's still considered live search even with the delay. So I guess my solution doesn't really solve the problem, but it does make it work the way I want it to. It seems in the line |
Well, then looks like there is a problem that liveSearch is always false. I have found that this line tablesorter/js/jquery.tablesorter.widgets.js Line 1240 in d73e951
Before it it is true, but after it is false. And it is the same in bind keyup function. Now it is still not working even if i set it hard-coded to true. It still immediately calls tsf.checkFilters and this follows to tsf.findRows which is the main filtering one, as soon as i press just one character it calls it all and it slows as hell, freezes for a sec. This is the main reason i need it, i have more than 1000 rows and filtering has a lag, every character input immediately repeats the lag cuz delay is not working and no way to set minimum search characters still with delay. I need this to work ASAP. |
HI everyone! Sorry for the long delay in responding. I've been away on a much needed extended vacation. I believe the problem is the same as the issue described in #1152. In v2.27.7, a listener for the "input" event was added to solve issue #1280. And because "input" is fired after each change to the input value, it bypasses the live search setting. I think the best solution might be to not include the "input" event listener unless a mobile browser is detected. I don't like to use browser sniffing, but it might be the best solution in this case. |
Well it still don't work, the best solution is the library actually to work as it should, i see no reason this can't work in the best possible way then there are many rows, desktop cpu are also not so fast. So filter_searchDelay should work This way it won't try to search anything every time i enter next letter if it is lower than say 3, just make it stop do anything if it is not x characters, and after it is say 3 chars the filter_searchDelay kicks in, preventing it to start search too soon and thus making it LAGGY or even freeze the browser. Now for every key input it starts the search and if there is lots of rows it overlaps the calls = lag/freeze, this needs to be fixed. I have tested it and if the delay would work as intended there is a single call and it is quite faster. |
I've configured If this isn't going to be fix soon-ish, is there a temporary workaround? |
Hi @JamoCA! Yes, sorry, I did find a fix for this issue, but I have not had a chance to thoroughly test it. I will go ahead and push it to the master branch. But I don't want to push a patch until I can resolve the issue with Edge (see #1303). I would appreciate it if you would let me know if any issues arise with the fix. |
This should now be fixed in v2.28.0! |
filter_searchDelay is still not working, example is the same as in the first comment, delay is 5 sec, but no delay at all, so why it is closed but not tested at all? |
Hey @andrewpros! Sorry, I was in a rush to get the pager fix out. I thought this was related to the |
As for setting a limit on the minimum number of characters, set it in the $('table').tablesorter({
usNumberFormat: false,
widgets: ['zebra', 'filter'],
widgetOptions: {
filter_liveSearch: 5, // start searching after 5 characters have been entered
filter_searchDelay: 5000
}
}); |
DOH, not fixed yet... still working on it. |
Ok, now it should be all fixed. Please try these two demos: The fix is in the master branch. A minor patch update has not yet been planned, but I won't wait too long. |
Nice, now it's working thx. There is one problem only, if i input minimum number of characters and then backspace it, it won't return to default set, stays filtered as it was when minimum characters provided. There should be some check if min chars are set and we delete at least one or more it should disable the filter and show initial full list again. |
Hi @andrewpros! I have made an attempt at show the full list after pressing backspace, but when the full table is shown, the filters are cleared... I'll need to find a different solution once I switch focus back to this repo. |
@Mottie I don't get it, this is the point, to disable filters when we are below min chars if min chars was set. |
Yes, I know... I was telling you that I am still working on it. |
@Mottie Well as we see it was not clear enough for me :-) |
These changes are all in v2.28 as far as I can tell, but I'm still suffering from the delay not working. Have set the delay to 1000ms+ and still it seems to fire after the second character no matter what. UPDATE: I set filter_liveSearch to false, and filter-selects now required hitting enter to filter the results, however, I moved over to the field I was having problems with triggering after two (of three) characters and a 1000ms delay, and it is still triggering on two characters being entered, despite the delay and liveSearch being false. |
As in the title
I set it but it is always instant, external, column filters, all the same.
Example http://jsfiddle.net/9tBgZ/115/
Any help @Mottie, i know it was an issue some time ago, but supposedly it was fixed, but this is the same example it was posted then.
The other issue is i don't see a way to set minimum characters to start searching.
The text was updated successfully, but these errors were encountered: