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

Bind to Focus Event

2 Answers 25 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 05 Oct 2019, 02:02 AM

I am able to get a client-side reference to the combobox by using:

.HtmlAttributes(new { id = "myDropDown" })

and

$("#myDropDown").data("kendoComboBox")

 

However, I can't seem to figure out how to bind to the focus event. There is no server-side event method (such as Select(), Change(), etc) for it that I can see and it doesn't appear in the API documents.I am essentially trying to do something like this:

$("#myDropDown").on('focus', function () {
                $("#myDropDown").data("kendoComboBox").open();
            });

 

Thank you

2 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Danchev
Telerik team
answered on 09 Oct 2019, 03:59 PM

Hello Josh,

To open a ComboBox on focus: in a document.ready handler get a reference to the ComboBox, attach a focus event handler to its input element and open the dropdown with the open API method:

<script>	
	$(document).ready(function() {
		var combobox = $("#myDropDown").data("kendoComboBox");

		combobox.input.on("focus", function () {
			combobox.open();
		});
	})
</script>

Give this a try and let me know if it works as expected.

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.
0
Josh
Top achievements
Rank 1
answered on 09 Oct 2019, 04:06 PM
Thanks Ivan, that did the trick.
Tags
ComboBox
Asked by
Josh
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Josh
Top achievements
Rank 1
Share this question
or