Currently the only way the user can open the dropdown is by double clicking
At the moment I have tried this in a jexcel table with multiple sheets, the dropdown is opened with the down arrow key and closed with the tab key but does not save the selected value
document.getElementById('spreadsheet').onkeydown = e => {
if (e.code == 'ArrowDown') {
let cell = document.querySelector('.jexcel_dropdown.highlight-selected');
let instances = document.querySelectorAll('.jexcel_container');
let currentInstance = Array.from(instances).find(c => c.style.display != 'none');
let dropdownHasFocus = document.querySelector('.jdropdown-focus');
if (cell && currentInstance && !dropdownHasFocus) {
currentInstance.jexcel.openEditor(cell);
}
} else if (e.code == 'Tab') {
let cell = document.querySelector('.jexcel_dropdown.highlight-selected');
let instances = document.querySelectorAll('.jexcel_container');
let currentInstance = Array.from(instances).find(c => c.style.display != 'none');
let dropdownHasFocus = document.querySelector('.jdropdown-focus');
if (cell && currentInstance && dropdownHasFocus) {
currentInstance.jexcel.closeEditor(cell);
// prevent lost focus
currentInstance.focus();
}
}
};
JSFiddle
Currently the only way the user can open the dropdown is by double clicking
At the moment I have tried this in a jexcel table with multiple sheets, the dropdown is opened with the down arrow key and closed with the tab key but does not save the selected value
JSFiddle