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

Have to press tab two times to go to next input

1 Answer 217 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
satyavir
Top achievements
Rank 1
satyavir asked on 12 Jul 2019, 11:32 AM

The default functionality of kendo jquery combobox is that whenever we search something and hit tab it selects the item and in the next tab hit, the focus goes to the next input . However I want to combine these two steps, so that only one tab hit should select and move the focus to the next element. (e.g in devexpress https://demos.devexpress.com/MVCxDataEditorsDemos/Editors/ComboBox  if you search in the combobox and press tab it selects the drop-down item and focuses on next input immediately). Is it possible to do in kendo combobox?

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 Jul 2019, 08:24 AM
Hello Satyavir,

The desired behavior could be achieved by subscribing to the keydown event of the ComboBox input as follows:
var combobox = $("#countries").getKendoComboBox();
 
combobox.input.on("keydown", function(e) {
  var filter = combobox.dataSource.filter() || { filters: [] };
 
  if (e.keyCode === 9 && filter.filters[0]) { //TAB
    combobox.select(combobox.current().index());
    combobox.wrapper.nextAll(".k-input").eq(0).focus();
  }
});

I have also prepared a Dojo example that demonstrates the above. Important to note is that the logic for focusing the next element in the sample relies on the .k-input class. This should be changed according to how the page/form is built in the actual solution.

Regards,
Dimitar
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
ComboBox
Asked by
satyavir
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or