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

capture text being typed

1 Answer 215 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 03 Jan 2020, 08:37 PM

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?

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 07 Jan 2020, 03:19 PM

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.
Tags
MultiSelect
Asked by
George
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or