skiphoppy
skiphoppy

Reputation: 102803

How can I get the highlighted item on an extjs combobox?

I have a routine to delete items from an ExtJS combobox when the user hits control-delete. Currently this routine deletes the selected item, but I want to instead delete the highlighted item. This combobox is being used for an autocompleted value and I need users to be able to delete values from their history. When they start typing a list of options comes up in the combobox and they are pointing to the item they want to delete and hitting my keystroke, but instead it deletes the currently selected value, which is not what they want.

How do I get the value that is being highlighted on the combobox?

Upvotes: 0

Views: 447

Answers (1)

skiphoppy
skiphoppy

Reputation: 102803

The following seems to work:

var list = combo.getPicker().getNavigationModel().view
var highlightedItem = list.highlightedItem
var index = list.indexOf(highlightedItem)
var highlightedRecord = combo.store.data.items[index]

Upvotes: 1

Related Questions