lorenzofox3 / Smart-Table

Code source of Smart Table module: a table/grid for Angularjs
http://lorenzofox3.github.io/smart-table-website/
1.8k stars 513 forks source link

#779 Last space trim when typing fast #803

Closed FreeFrags closed 6 years ago

FreeFrags commented 6 years ago

optional st-trim-search-input added to the table if set it will use the set value if not set it will use false

FreeFrags commented 6 years ago

@josh-freislich updated the test as requested

FreeFrags commented 6 years ago

@josh-freislich as requested

lorenzofox3 commented 6 years ago

Hi, and thank you everybody for the work and review here. I would rather see this option (and the trimming ) at the level of stSearchDirective rather than on the table controller as it is not global to all directives. I believe it will be more consistent.

That would imply:

  1. passing a flag or taking the default value from the config (https://github.com/lorenzofox3/Smart-Table/blob/master/src/stSearch.js#L9)
  2. trimming the input https://github.com/lorenzofox3/Smart-Table/blob/master/src/stSearch.js#L15 if flag is on and input is a string.
  3. set the default value on the global config https://github.com/lorenzofox3/Smart-Table/blob/master/src/stConfig.js (false by default would be better)

for the tests I suggest on test case when flag is on and input is a string and another one when flag is on and input is not a string.

I'll close that PR so you can start with a fresh start.

If you want me to do it, I don't mind (I have a bit more time now) but I think that would make a good first contribution for you as you have already passed some time doing it.

Let me know if you need any help.

Cheers