Feature Request to Issue filter_searchTrigger #1522
Hey Mottie,
i created a pull request for the enhancement in Issue #1522.
Maybe you have some time to review and test the feature? I created a fiddle: http://jsfiddle.net/856bzzeL/1568/
Option description: to enable the feature the option filter_liveSearch must set to false
Possible Values: bool = default Number = keycode String = events ( search, blur ) Objects = { keyCode : Number, alt: bool, ctrl: bool, shift: bool }
Examples: filter_searchTrigger : false -> same als ['search', 'blur', 13] filter_searchTrigger : [13] -> Enter filter_searchTrigger :[ 13, 9] -> Enter and tab - key filter_searchTrigger : ['blur'] filter_searchTrigger : [{keyCode: 13, ctrl:true}] -> ctrl + Enter
Hi @CiTRO33!
Thanks for your work on this enhancement. I haven't actually tested the code, but I like the concept so far. Here are a few comments I have on the code I see:
-
I think that the "search" event should always be enabled, since it's the developer triggering it on the table cell and not the user.
-
Within the
filter_searchTrigger, let's use key names like 'enter', 'tab', etc, instead of the key code number. They can be added to the$.tablesorter.keyCodesdefinition. Then within the new code, useObject.keys(which has good support) for comparisons.filter_searchTrigger : [{key: 'enter', ctrl: true}] //=> ctrl + Enter -
filter_searchTriggershould have a default of['blur', 'enter'], notfalsebecause that would imply that there is no search trigger. -
Please follow the code formatting conventions that already exist in the code base. I don't have the
.eslintrcset up to match the convention yet, but hopefully it's obvious that there are pretty much spaces everywhere (before and after parenthesis and curly brackets, etc).
Hi, thanks for the fast response!
i commented the search event out. So it's get triggered always. But if you look into the fiddle after pressing "Enter" in a filter field, a search event is triggered. I didn't figured out where is it comming from - but for my usecase its ok that the search is triggered on pressing "Enter".
filter_searchTriggershould have a default of['blur', 'enter'], notfalsebecause that would imply that there is no search trigger.
i agree, but when the default is ['blur', { keyCode: 'enter' } ], and the user init with: filter_searchTrigger: [{keyCode: 'tab'}] the config option get merged as [{keyCode: 'tab'}, {keyCode:'enter'}]
i don't know how the widget options, get merged. - so i decided to go with the value false.
i tried to format the code - but at the moment i have only notepad++ and the github-webeditor to format - sorry
Hi @CiTRO33!
I'm really sorry for not responding earlier. I've been crazy busy... new job, new baby, etc.
I am trying to catch up with everything now. Would you be willing to update the documentation for this enhancement? Adding it to the demo would be awesome too! 😻
Hi @Mottie , i added Docs and Demos (untested) - i hope that helps u to save some time =)