0

I have the following code in my Kendo Combo Box:

    .Events(events =>
    {
        events.Select("carUpdate");
        events.DataBound("dropDownBind");
    })

My carUpdate js method is then as below:

function carUpdate(e) {
    debugger;
    var rowData = getRowData(e, this);

    //If enough data is given to identify unique technology autocomplete the row
    var grid = $grid.data('kendoGrid');

    if (isUniqueManufacturerDataProvided(rowData)) {
        rowData.CarName = this.dataItem(e.selectedIndex).Name;
        rowData.CarId = this.dataItem(e.selectedIndex).Id;
        return;
    }

    if (this.selectedIndex === null || this.selectedIndex === -1
        || e.sender._last === kendo.keys.TAB) {
        rowData.CarName = pleaseSelect;
        rowData.CarId = null;
        //$("#Car").data("kendoComboBox").value(pleaseSelect);
        //$("#Car").data("kendoComboBox").trigger("close");
        return;
    } else {
        rowData.CarName = this.dataItem(e.selectedIndex).Name;
        rowData.CarId = this.dataItem(e.selectedIndex).Id;
    }
}

If my ComboBox Contains AB, ABC, ABCD, ABCDE

If I enter A and press the Tab Key I want the combo box to revert to my Please Select Option and move to the next Field in the grid. However what I am finding is the if I just Enter A and press Tab the AB option is getting selected in the box. The other behaviour I want is that ABCDE is entered (i.e - enough data so the combox is filtered to only 1 option) and the Tab key is pressed this option is selected and the cursor moves to the next field in the grid. Is there something I have missed in my js to make this work

Ctrl_Alt_Defeat
  • 3,933
  • 12
  • 66
  • 116
  • If I understand correctly, what you need is set [suggest](https://docs.telerik.com/kendo-ui/api/javascript/ui/combobox/configuration/suggest) to true. – Long Le Jan 13 '20 at 07:57
  • @LongLe I will take a look but not sure that will work - if I type ABC (then ABCD and ABCDE) could still be correct values so what would it select? Ill test it though – Ctrl_Alt_Defeat Jan 13 '20 at 10:07
  • If _suggest_ set to true the widget will automatically use the first suggestion as its value. – Long Le Jan 13 '20 at 10:09

0 Answers0