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

Select first item automatically

7 Answers 1159 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 06 Feb 2013, 09:25 PM

Using the auto complete widget, is it possible to automatically highlight (but not select) the first item in the dropdownlist, but still allow the user to type into the textbox?

Currently, when you type in the textbox and see the item you want as the first in the dropdownlist you have to hit the down arrow to select it, then tab to go to the next field. We'd like it to have that selected by default. 

7 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 07 Feb 2013, 07:49 AM
Hello Dan,

 
Enable highlightFirst functionality to achieve your goal.

Kind regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Peter
Top achievements
Rank 1
answered on 02 Mar 2018, 05:34 AM

I can't work this out for MVVM, do you have any advice as to how I would go about finding out how to do this?

It seems there is no explicit documentation on MVVM

 

 data-bind="events: { select: onSearchItemSelected }"
 data-options="{ highlightFirst: true }"

 

I've also tried data-bind="options : { highlightFirst: true }"

0
Peter
Top achievements
Rank 1
answered on 02 Mar 2018, 05:46 AM

NB I also tried adding it in code, but it simply doesn't take effect - I guess it has be initialized with the option

let kendoInput: kendo.ui.AutoComplete = this.searchInput.data("kendoAutoComplete")
kendoInput.options.highlightFirst = true

0
Plamen
Telerik team
answered on 05 Mar 2018, 09:00 AM
Hello,

This can be achieved by using the custom widget binding and triggering a setOptions as for example it is done here.

Regards,
Plamen
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Peter
Top achievements
Rank 1
answered on 05 Mar 2018, 11:11 PM

Thanks, is it possible to make this simpler if I don't need to vary/bind the "highlightFirst" value.

I just need it to be "true" - and it never needs to vary or change from "true".

I have a problem implementing a code solution like you've suggested because the MVVM I use is common across many usages in the code - so to implement this custom code binding is a significant change that really should just be "highlightFirst: true"

0
Peter
Top achievements
Rank 1
answered on 05 Mar 2018, 11:45 PM

Thanks, it's also odd that this doesn't compile in typescript owing to this error:

"Property 'widget' does not exist of typeof 'binders'"

`kendo.data.binders.widget.highlightFirst = ...1

0
Plamen
Telerik team
answered on 06 Mar 2018, 07:43 AM
Hello,

You can hardcode the value of the property to true but the structure of the code should remain the same in order to work correctly in MVVM scenarios.

As for the typescript issue - it seems like it is not added to the typescript definitions. I have logged the issue and you can follow it s status here

 Thank you for reporting this issue and for your concern with Telerik widgets.

Regards,
Plamen
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
AutoComplete
Asked by
Dan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Peter
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or