Description of the limitation and why it is relevant to address
As a dev I want to create a table field with certain columns and/or cells locked, such that the user can’t change them.
A typical example is the table with the lap and anchorage lengths for different steel rebar diameters. The user should be able to change the lengths, but not the diameters.
Submitter proposed design
In the example of the lengths table defined as:
project.tab = vkt.Table("", default=default_lengths)
project.tab.diam = vkt.AutocompleteField("Diamètre", options=HA_diam)
project.tab.L_lap = vkt.IntegerField("Lap length")
project.tab.L_ancr = vkt.IntegerField("Anchorage length")
diam must be locked, L_lap and L_ancr are modifiable by the users.
Implementation suggestions:
- Add a new
is_lockedboolean argument to each field that can be used in a table. Ifis_locked=True, the user can’t change the value from the default value.
→ Ex:project.tab.diam = vkt.AutocompleteField("Diamètre", options=HA_diam, is_locked=True) - Add a new
locked_columnslist argument tovkt.Table, which takes the name(s) of the columns to be locked.
→ Ex:project.tab = vkt.Table("", default=default_lengths, locked_columns=["diam"])
Current workarounds
Add a validation on_next step to confirm that the user didn’t change the field(s) which shouldn’t be.