Hey there I have the same issue. I have read this post and the closed one here Best Way To Handle Auto Selection Of New Row In Table but none of the solutions work for me.
I also have a table and a custom action at bottom of the table with a plus icon to add a new row and I have a query which is then triggered and creates a new entry in my database. I also have a variable called newRowID. After the new row is created I use the success event handler of this query to run
- set Variable and set it to the new created ID
- get query to update the table containing the new row
- selectRow with key and put the ID variable in
My Table is set to use this ID as Primary Key.
But it doesnt select this row. It just doesnt work. I have now clue why...
What else have I tried?
I tried setting the default cell selection to "none". I checked the box at "persist row selection".
Since I wondered if this happens because the query ran asyncronous and wrote a js script.
let id;
postQuery.trigger({onSuccess:(data)=>{
id = data.id;
getQuery.trigger({onSuccess:()=>{
console.log(`trying to select row with primary key ${id}`);
table1.selectRow( { mode: 'key' }, id );
}})
}})
When I run this script it also adds the row updates the table but does not select the new row altough in the console I can read my message "trying to select row with the primary key 42"
Why isn't this working?