Hello!
I'm using a listView and I'm dinamically creating new editable text rows with a button!
The button is working fine, but everytime I create the new text field the cursor to type the text is not changing the position, someone know how to change the position of the typing cursor?
I asked to the "copilot" of retool and it returned me
function changeCursorToNextElement() {
const listView = listView2; // assuming "listView2" is the ListViewWidget
// Get the index of the currently focused element
const currentIndex = listView.value.findIndex(item => item.retoolInternal_rowKey === listView.currentRowKey);
// Calculate the index of the next element
const nextIndex = currentIndex + 1;
// Set the focus on the next element
listView.setCurrentViewIndex(nextIndex);
// Set the cursor to the input field of the next element
const nextElement = listView.rows[nextIndex];
const inputField = nextElement.querySelector('input');
inputField.focus();
}
return changeCursorToNextElement();
But a lot of functions like querySelector, setCurrentViewIndex are not working.
Is there a way to change this cursor?