Goal
I'm trying to create a table that users can edit, and add row(s) to. I want to disable editing if a custom "delete row" row action I've created is enabled.
Steps (to reproduce error)
- Create a switch component with the label "Enable Editing".
- Create a table component and use the demo data as it exists.
- Remove
ID
as the primary key. - Go to any column - let's say
First Name
. - In its Interaction settings, set Editable to dynamic, and its value to be
{{ switch1.value }}
(assuming you didn't rename the switch component). - In the table's Interaction settings, make the Add Row toolbar button visible.
- Now, assuming you've got all this setup, make sure you can edit the existing table rows when you enable the switch.
- Add a row and see if the column you chose in Step 4 is editable or not when the switch is enabled. You will see that it is not.
Details:
This can be worked around when you do the following:
- Go to the column you chose in Step 4 earlier.
- Disable Editing and then setup Editing in new rows only to be dependent on the value of the switch.
- Now setup the same dynamic setting for Editing as. you did in Step 5 earlier.
- Try to add a row with and without the switch enabled. You'll see that the column selected in Step 4 will now be editable.
App json export:
Here are the relevant parts that changed upon implementing the workaround:
<Column
id="bfee8"
alignment="left"
editable="{{ switch1.value }}"
editableInNewRows="{{ switch1.value }}" # this gets added
format="string"
groupAggregationMode="none"
key="firstName"
label="First name"
placeholder="Enter value"
position="center"
size={100}
summaryAggregationMode="none"
/>