I have a select in my app that have a default value : {{scaninventory.data.LocationID[0]}} (null until a user enter a value)
Not sure when It broke but before we where seing the Label and not the ID.
Now It shows the ID instead of the label.
If I select the ID 32 in the dropdown it shows the label, but if I use the default value to input the 32 it doesn't show the label associated.
jg80
July 22, 2024, 11:51pm
2
Is it possible that the default is a number in String format and the ID needs to be a number?
The ID needs to be a number yes, but i'm not sure still how to make it work again
It says that the value has to be a string
jg80
July 23, 2024, 5:16pm
4
You can use {{ String(scaninventory.data.LocationID[0) }}
to make it a string.
Thank you It is working !!!
1 Like
Do you think it is possible to remove the undefined that is showing ? (be empty instead)
jg80
July 25, 2024, 8:05pm
7
Using the ternary {{ scaninventory.data.LocationID[0] == undefined ? '' : String(scaninventory.data.LocationID[0]) }}
should work. You can change it to display some other text besides an empty string, like 'Nothing selected'
.