Perspective - Table and boolean column

Good afternoon,
probably I'm missing some settings, but I'm trying to show a boolean status in a column with a toogle.
The problem is that I can make it change color, it's always grey.

Initially the column is a "integer", I try to cast to a "boolean" too but it doesn't work in any case.


It's grey because the switch is disabled.
check the editable checkbox and it will accept the color configuration.

1 Like

Two more things:

  1. Rendering the column as boolean and making it editable will not result in any user changes being written to your data unless you provide your own logic within an Event on what to do with the updated data.
  2. If you're expecting any of rows to be false/inactive/off, but you're seeing true/active/on, verify that your data is not a string representation of a numeric value, ie:
print(bool("0"))
True
2 Likes

Thank you @pascal.fragnoud for the help, the editable property was the problem and thanks @cmallonee for the suggestions.

Have a nice day!

Dear @cmallonee one more information about this please.. Now that I deselect the editable property I can see the toggle color changes according to the boolean value, but if I click on it I can change it's value. As you said it doesn't change the data actually, but I would like to avoid the click so to see the present data..
How can I do?

You can set editable to false.

The editable property dictates whether a user can interact with the toggle switch. Your original problem was probably best resolved by modifying the CSS style values assigned to disabled toggle switches, instead of simply allowing for them to be editable, as you're now seeing.

You may need to grow comfortable with using the stylesheet.css resource to manage how toggle inside of a Table are displayed.

1 Like

Thanks for the reply, tomorrow I will make some test with the CSS style and I update the topic.

Have a nice day.

1 Like