Istvan
August 8, 2022, 7:00am
#1
Hi,
I am trying to populate a default value of an input field with a ternary, but it is executing just upon true.
{{ table1.selectedRow.data.date_1 ? table1.selectedRow.data.date_1 : moment().format('YYYY-MM-DD HH:mm:ss') }}
So when date_1 doesn't have any data, the current time is not added.
Using a date component results in the same.
What I am doing wrong?
Thank you!
ScottR
August 8, 2022, 12:24pm
#2
Without seeing the data or the table...
Try
{{ table1.selectedRow.data.date_1 != null ? table1.selectedRow.data.date_1 : moment().format('YYYY-MM-DD HH:mm:ss') }}
Istvan
August 13, 2022, 12:19pm
#3
Hi Scott,
I don't really understand why, but it looks like
{{ table1.selectedRow.data ? table1.selectedRow.data.date_1 : moment().format('YYYY-MM-DD HH:mm:ss') }}
does the trick.
Anyway, thank you for the willingness to help!