Hello everybody,
First of all, let me say that I am a beginner...
Currently I am consulting the Retool documentation.
I am in the chapter "Increment IDs automatically"
Unless I am mistaken, the following code, which is listed in the documentation, does not work:
{{
table1.selectedRow
? table1.selectedRow
: { id: (Math.max(...query1.data.id) + 1).toString() };
}}
If a line of the table is selected, no problem, the fields of the form are completed correctly.
If no line is selected, no field is completed, including the "ID" field when it should be returned by the code.
However, I can get this code to work:
{{
table1.selectedRow.id
? table1.selectedRow
: { id: (Math.max(...query1.data.id) + 1).toString() };
}}
I would like explanations and to know if my workaround is good.
To finish this code we find it in the documentation at this location also:
Thanks in advance. Sincerely.