This is a migrated thread and some comments may be shown as answers.

Trim search value in AutoComplete

1 Answer 590 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Marcin asked on 15 May 2019, 01:14 PM

Hello,

is there a way to trim search value in autocomplete? The scenario is that as first thing when I use autocomplete I press space, to see all values on list, and then if there are many I start to type search value, however initial space is not trimed, so search result is not accurate.

 

1 Answer, 1 is accepted

Sort by
0
Petar
Telerik team
answered on 16 May 2019, 02:58 PM
Hello Marcin,

The trimming of the search value could be accomplished by using the trim() JavaScript method when filtering event is being triggered. For example, we could define onFiltering() function which would be executed every time the filter event is triggered. Here is onFiltering()'s definition:
function onFiltering(e) {
     e.filter.value = e.filter.value.trim();
 }

This Dojo demonstrates the described above functionality.

Please, check the proposed solution and let me know if you have any questions.  
Looking forward to your reply. 

Regards,
Petar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
AutoComplete
Asked by
Marcin
Top achievements
Rank 1
Answers by
Petar
Telerik team
Share this question
or