appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

[Bug]: Select widget options does not work when values are of data type numbers or boolean

Open tomjose92 opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

I have a Select widget which I have connected to some options having the value as a boolean true/false. But when I pass the default value as true/false, the Select widget is not showing any label as selected.

On further analysis I understood that the values have to be in string format, ie as "true"/"false", then only it will be evaluated properly. The same issue occurs for numbers as well. I need to assign options with value as "1", "2" instead 1, 2, etc

Data having boolean or number values, usually passed from a Query or API does not necessarily come in string format. So we should allow the Select widget to be compatible with such data instead of needing to convert it to string during Read Data, and back to original format when writing it back.

Steps To Reproduce

  1. Drag and Drop a Select widget
  2. Hardcode an array of options of the below format { label: "True", value: true }, { label: "False", value: false }
  3. Set the defaultValue of the widget as false

You will see that the Select widget is not set with any label/value. But if we change the options to stringified true or false, it works. Same applies for numbers

Public Sample App

No response

Environment

Production

Severity

Low (Cosmetic UI issues)

Issue video log

No response

Version

Cloud

tomjose92 avatar Sep 20 '24 16:09 tomjose92