Manipulate search string

3 posts, 1 answers
  1. Rinck
    Rinck avatar
    23 posts
    Member since:
    Feb 2013

    Posted 23 Dec 2013 Link to this post

    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. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 24 Dec 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Answer
    Rinck
    Rinck avatar
    23 posts
    Member since:
    Feb 2013

    Posted 24 Dec 2013 Link to this post

    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
Back to Top