How to display boolean as checkbox in a Perspective table

Hi all,

I am trying to use a table to display a dataset of boolean values, like below:
VisionTable

When I pass the same dataset tag to a Perspective Table, the cells display as text instead of checkboxes:
PerspectiveTable

This is the props values for one of the columns:
Config

Can someone help me understand what I was missing to make it work?

Thanks in advance

Charles Han

You actually need to specify the field property for the render modes to have an effect. In your use-case, set columns[1].field to “Input?” (you might also need to set columns[0].field to “TagPath”). HOWEVER, there is an open ticket right now which is preventing boolean values in DataSets from rendering correctly - they will always display as selected because the DataSet stores the value as “false” (String), which isn’t being coerced to False or 0 correctly. The fix for that should be in very soon.

Thanks for the reply. That is exactly why checkbox didn’t show.

Now I run into another question:
When I check/uncheck a box from preview mode, the change does not transfer back to the dataset memory tag that the table props.data is binded to. I have checked that binding is Bidirectional and column edit is enabled.

I am not sure if this is related to the issue of False not showing properly that you mentioned. Or is there any other step I have missed to allow perspective table write back to dataset?

Thank you!

I have the same question, and I don’t know how to change value of the Table data via change the checkbox value.

Hi,

The latest nightly includes a fix for the ticket Cody described above.

The table component does not write back to a bound dataset after an edit is committed. Instead, we provide you with the ability to listen to the onEditCellCommit event and then do with that information as you please. The event has the shape:

{ 
  column: string | number;
  row: number;
  value: any;
}

Hi

The onEditCellCommit event script works, thanks!

There is one related issue I found:

If I set both enableRowSelection and enableColumnSelection properties to false, the onEditCellCommit script will not fire. I have to select either one, or both in order for the script under onEditCellCommit to execute.
enableRowColSelections

But if I have either set to true and use the table in runtime, the first click to the checkbox does not toggle its value, but selects the cell. Then I need to click again to flip boolean value.
highlightCell

This is an extra step. Is there a way to use onEditCellCommit event without turning row/column selection ON?

Thank you!