Overview
The key-value field allows you to interact with one-dimensional JSON object:array cast to the model property:
Adding rows
An action button is displayed below the field to allow the user to add a new row.Setting the add action button’s label
You may set a label to customize the text that should be displayed in the button for adding a row, using theaddActionLabel() method:
Preventing the user from adding rows
You may prevent the user from adding rows using theaddable(false) method:
Deleting rows
An action button is displayed on each item to allow the user to delete it.Preventing the user from deleting rows
You may prevent the user from deleting rows using thedeletable(false) method:
Editing keys
Customizing the key fields’ label
You may customize the label for the key fields using thekeyLabel() method:
Adding key field placeholders
You may also add placeholders for the key fields using thekeyPlaceholder() method:
Preventing the user from editing keys
You may prevent the user from editing keys using theeditableKeys(false) method:
Editing values
Customizing the value fields’ label
You may customize the label for the value fields using thevalueLabel() method:
Adding value field placeholders
You may also add placeholders for the value fields using thevaluePlaceholder() method:
Preventing the user from editing values
You may prevent the user from editing values using theeditableValues(false) method:
Reordering rows
You can allow the user to reorder rows within the table using thereorderable() method:
Customizing the key-value action objects
This field uses action objects for easy customization of buttons within it. You can customize these buttons by passing a function to an action registration method. The function has access to the$action object, which you can use to customize it. The following methods are available to customize the actions:
addAction()deleteAction()reorderAction()