I would like to determine if a row has been selected and send a message if it hasn't.
I have developed some code as below which does not work.
const row = table1.selectedRow?.data;
console.log(table1.selectedRow);
if (!row || Object.keys(row).length === 0) {
utils.showNotification({
title: "No patient selected",
description: "Please select a patient from the table first.",
notificationType: "warning",
})} else {
modalFrame3.show();
return true;
}
Has anyone here got this figured out?
Mike
Summary
A warning-and-modal flow isn't working because the code checks table1.selectedRow?.data to determine whether a table row has been selected, but that expression never returns a value.
AI Response
In the current Table component, selectedRow returns the selected row's data object directly and is null/undefined when nothing is selected — there is no nested .data sub-property (that structure belonged to the classic Table component). Referencing table1.selectedRow?.data therefore always yields undefined, so the empty-selection branch never behaves as intended. Reference the row directly instead and test it for null, e.g. const row = table1.selectedRow; if (!row) { utils.showNotification({ title: 'No patient selected', description: 'Please select a patient from the table first.', notificationType: 'warning' }); } else { modalFrame3.show(); }. Confirm the exact shape by inspecting table1.selectedRow in the state/left panel while a row is and isn't selected.
Sources
Property 'selectedRow' doesn't work
Solved topic clarifying that the new Table component's selectedRow is referenced directly rather than through a nested property, which is the root cause here.
Table SelectedRow is not working
Solved report of selectedRow appearing not to work, with guidance on correctly accessing the selected row's values.
The Community Team is testing out a new automation. Let us know if it's helpful (or not) by leaving a
,
, or
. Or by marking this post as the "Solution"! Let us know if you have any feedback here. 
1 Like
Hi @mdsmith1 , thanks for posting! This one is a quick fix.
The Resource Bot above had the right idea, and the docs back it up: "The property to access the Table's selected row changed from table1.selectedRow.data to table1.selectedRow" (Table component and Legacy Table component differences). Because .data doesn't exist on the current Table's selectedRow, your check always saw undefined, so the warning fired even with a row selected.
I reproduced this on my end. Dropping ?.data makes it work as you described: the warning when no row is selected, and the modal when one is.
const row = table1.selectedRow;
console.log(table1.selectedRow);
if (!row || Object.keys(row).length === 0) {
utils.showNotification({
title: "No patient selected",
description: "Please select a patient from the table first.",
notificationType: "warning",
});
} else {
modalFrame3.show();
return true;
}
Give that a try and let us know how it goes. If it still doesn't behave, share what console.log(table1.selectedRow) shows with and without a row selected, and we'll dig in from there.
Thanks Adam:
Currently I can not login to Retool.
I am trying to get help from Security but I don't know how long that will take.
Mike
Hi @mdsmith1,
Sorry to hear you're locked out of Retool. I can see you've also written in to our support team, and they're the right folks to get you back in, so it makes sense to focus on that first.
Once you're back in, give the updated code from my earlier post a try. The only change is dropping ?.data, so it reads table1.selectedRow instead. If it still doesn't behave, paste what console.log(table1.selectedRow) shows with and without a row selected and we'll dig in from there.
No rush on this one. Just reply here whenever you're back in!