Hello!
I have
- Database with columns “Group”, “Num”, “Name”, “Abbr”. It was linked with a table (similar titles for cols). It has some rows of data
- Button for filling in the textbox
- Textbox
I want to do that:
- When I click button, the value of “Abbr” column from selected row is appears in the textbox below.
- When I click second time, the next value is appears at the next line.
I tried add code to onRowSelect, onCellSelect, onButtonClick, but cannot get selected row index. My cellRowIndex var is outside to be a global.
Now my code as follows:
let cellRowIndex;
export function button1_click(event, $w) {
//Add your code for this event here:
let tableRows = $w("#table1").rows;
console.log(tableRows);
let value = tableRows[cellRowIndex]["abbr"]; // "field value"
console.log(value);
$w("#textBox2").value = value;
}
export function table1_cellSelect(event, $w) {
//Add your code for this event here:
$w("#table1").onCellSelect( (event, $w) => {
cellRowIndex = event.cellRowIndex; // 1
console.log(event);
} );
}
It shows all the data in console, but then writes:
TypeError: Cannot read property ‘abbr’ of undefined
Sorry for my English. How can I get selected row index?