After creating an array, I need to access the elements outside of the loop. I am aware that they are not in the scope and using 'this.' before them does not grant access.
colIdx = colIdx + this.columns.findIndex(c => c.editable);
this.focusInput(rowIdx, colIdx);
this.autocompletes.toArray().forEach(el => {
console.log(el);
})
My table contains numerous input fields with autocomplete functionality and suggestion panels. I have a custom method to allow tabbing with the enter key. Initially, tabbing did not close the suggestion panel, resulting in multiple open panels.
The method I created addresses this issue. The first two lines are essential for tabbing with the enter key.
this.autocompletes is a Querylist containing all input elements. By converting them into an array and referencing each element as el, I can execute a closePanel() method on el to close the suggestion panels. However, this approach closes all suggestion panels for all el elements. I need to target and close the specific suggestion panel that the user has focused on.
To achieve this, I must access el outside of the for-loop where it was initially created.