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

Manipulate search string

2 Answers 154 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Rinck
Top achievements
Rank 1
Rinck asked on 23 Dec 2013, 12:11 PM
Hi,

I have a working multiselect with a remote datasource with a ton of values (1500+).
The multiselect allows my users to start typing and find the item they're looking for.

What I would like to do is manipulate/verify their search term before actually searching. Here's an example to clarify.

All items are in the same format, six numbers or letters, followed by a dash, followed by 2 numbers, example:  3Z0000-02. The length of the code before the dash is always 6 characters (letters and/or numbers); if a code has only 2 characteristics, trailing zeros are added to pad the code to 6 characters (in the example 4 zeros).

To make searching easier/faster for the users, I want to allow them to type 3Z-02 and show 3Z0000-02 as a result. I know how to manipulate the string itself, but I am looking for a hook in the MultiSelect widget where I can manipulate the search string entered by the user, before it is used for searching.

Is this possible, and if yes, which event should I use to perform this manipulation? A small example of how to manipulate a search string before filtering the datasource would be greatly appreciated.

Regards,
Rinck



2 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 24 Dec 2013, 07:00 AM
Hello Rinck,

There is not built-in functionality that covers your scenario. You can use the keydown event of the input and manipulate the data entered there, as there is no MultiSelect event that you can use. You can see all the events available with the MultiSelect on the following link:

http://docs.kendoui.com/api/web/multiselect#events

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Accepted
Rinck
Top achievements
Rank 1
answered on 24 Dec 2013, 08:03 AM
Hi Kiril,

I read through the docs before posting and couldn't find anything then. But I managed to get it working by using the transport.parameterMap method of the datasource. That allows me to manipulate the search terms before they are submitted. I also considered manipulating it server side, but that would have required me to make changes to a class I use for all my datasources, so this was the most convenient for me.

Regards,
Rinck
Tags
MultiSelect
Asked by
Rinck
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Rinck
Top achievements
Rank 1
Share this question
or