I'm trying to get a column of comboboxes to move focus from one to the next one down when the user hits enter. The code below will move to the next one ok but the current one (and all previous ones) remains highlighted. Is there a way to deselect the old combo or a different way to change focus?
ASPX - C#
JS
ASPX - C#
cb.Attributes.Add("onkeydown", string.Format("ControlKeyPress(this,event,'{0}',{1});", "PurchaseComboBox", dataItem.ItemIndex)); |
JS
function ControlKeyPress(sender, args, control, index) { |
if (args.keyCode == 13) { |
var dataItems = createGrid.get_masterTableView().get_dataItems(); |
if (index < dataItems.length) { |
var nextControl = dataItems[index + 1].findControl(control); |
var input; |
if (typeof (nextControl.get_inputDomElement) == "undefined") { |
input = nextControl; |
} else { |
input = nextControl.get_inputDomElement(); |
} |
window.setTimeout(function() { input.focus(); }, 0); |
} |
} |
} |