capture text being typed

2 posts, 0 answers
  1. George
    George avatar
    18 posts
    Member since:
    Jul 2019

    Posted 03 Jan Link to this post

    I'm using the multselect dropdown which is being populated from a db, how can I capture what the users is typing in the box, so I can filter based off of what the user is typing?

     

    Example: if they start typing:

      John

     

    i want to pass John to my service and filter the users that are named John.

    If  I use var x = $('name').data("kendoMultiSelect').text();

    I get an error: Cannot read property 'text' of undefined. Is there another way to grab the text from the multiselect?

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2104 posts

    Posted 07 Jan Link to this post

    Hi,

    The MultiSelect automatically sends the typed text with the request to the server with serverFiltering enabled, see this demo for example: https://demos.telerik.com/aspnet-mvc/multiselect/serverfiltering

    Note in the demo's source section that the action has a string text parameter, which will hold the typed text:

    public JsonResult ServerFiltering_GetProducts(string text) 
    {
    //...
    }

    As for getting the typed text on the client, you can attach a handler to the filtering event and get the text through the event data. Here's a dojo example, in which on typing in the input the text is logged in the console: https://dojo.telerik.com/uRAxOpoQ/2

    Regards,
    Ivan Danchev
    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.
Back to Top