The array field.

Properties

TitleArray Field
DescriptionField for list of items with same data type or structure.
JSON Schema Type(s)array
Field Typearray
Base Field TypeNone

Schema

PropertyTypeDefaultDescription
defaultanyThe default value to be assigned for this property. If the data for the field is empty or not provided, this default value will be plugged in for you. Specify a default value when you want to pre-populate the field's value ahead of time.
dependenciesarrayList of property dependencies.
descriptionstringDetailed description of the property.
disallowarrayList of disallowed values for the property.
formatstringData format of the property.
itemsobjectSchema for array items.
maxItemsnumberMaximum number of items.
minItemsnumberMinimum number of items.
readonlybooleanIndicates that the field is read-only. A read-only field cannot have it's value changed. Read-only fields render in a grayed-out or disabled control. If the field is rendered using a view with the displayReadonly attribute set to false, the read-only field will not appear.
requiredbooleanIndicates whether the field's value is required. If set to true, the field must take on a valid value and cannnot be left empty or unassigned.
titlestringShort description of the property.
typestringarrayData type of the property.
uniqueItemsbooleanItem values should be unique if true.

Options

PropertyTypeDefaultDescription
actionbarobject
actionbarStylestringtopThe kind of actionbar to render for each item in the array. Either 'top', 'bottom', 'left', or 'right'.
animatebooleantrueUp and down transitions will be animated
collapsedbooleanField set is initially collapsed if true.
collapsiblebooleanField set is collapsible if true.
disabledbooleanField will be disabled if true.
dragAndDropbooleanIf true, drag and drop is enabled for array items.
fieldClassstringSpecifies one or more CSS classes that should be applied to the dom element for this field once it is rendered. Supports a single value, comma-delimited values, space-delimited values or values passed in as an array.
focuscheckboxtrueIf true, the initial focus for the form will be set to the first child element (usually the first field in the form). If a field name or path is provided, then the specified child field will receive focus. For example, you might set focus to 'name' (selecting the 'name' field) or you might set it to 'client/name' which picks the 'name' field on the 'client' object.
formobjectOptions for rendering the FORM tag.
helperstringField help message.
helpersarrayAn array of field help messages. Each message will be displayed on it's own line.
helpersPositionstringbelowDefines the placement location of the helper text relative to the control (either 'above' or 'below')
hiddenbooleanField will be hidden if true.
hideInitValidationErrorbooleanHide initial validation errors if true.
hideToolbarWithChildrenbooleantrueIndicates whether to hide the top toolbar when child elements are available.
idstringUnique field id. Auto-generated if not provided.
labelstringField label.
lazyLoadingbooleanChild fields will only be rendered when the fieldset is expanded if this option is set true.
legendStylestringbuttonField set legend style.
optionLabelsarrayAn array of string labels for items in the enum array
readonlybooleanField will be readonly if true.
showMessagesbooleantrueDisplay validation messages if true.
toolbarobject
toolbarPositionstringtopLocation of the top-level toolbar to render for the array field. Either 'top' or 'bottom'.
toolbarStickybooleanIf true, the array item toolbar will always be enabled. If false, the toolbar is always disabled. If undefined or null, the toolbar will appear when hovered over.
toolbarStylestringbuttonThe kind of top-level toolbar to render for the array field. Either 'button' or 'link'.
typestringarrayField type.
validatebooleantrueField validation is required if true.
viewstringAllows for this field to be rendered with a different view (such as 'display' or 'create')

Example 1

Array field for an array of text items.

Example 2

Array field with options for sticky toolbar, min items, max items etc. Here we use the hideToolbarWithChildren option to keep the top-most button available to add new items to the list. We also hide the add button in the action bar for each row.

Example 3

Array field with array default value.

Example 4

Array field with string default value.

Example 5

Array field with item type as object.

Example 6

Nested array field.

Example 7

Array field name. Here we set the toolbarPosition option to bottom to position the toolbar below the array.

Example 8

Nested Array field name.

Example 9

Array field with an extra "clear" button in each item's action bar.

Example 10

Array fields support toolbar and actionbar options for defining custom actions. Actions are rendered by the view into the form and usually appear as a button bar.

For the toolbar, Alpaca assumes and auto-populates a single button - add.

For the actionbar (per item), Alpaca assumes and auto-populates the following buttons:

  • add
  • remove
  • up
  • down

Any properties you define for these actions will override the existing presets. Any new actions you define will be added to the overall set. You can explicitly enable or disable actions via the enabled property. Disabled actions are removed from display.

By default, the array field keeps labels turned off. If you want to turn labels on, use the toolbar.showLabels and actionbar.showLabels options.

Example 11

Array field rendered in display-only mode.

Example 12

An array field with four levels of nesting.

Example 13

An array field with nested radio elements.

Example 14

An array field with unique items enforced.

Example 15

An array field with radio selection embedded.

Example 16

An array field with dragAndDrop enabled.

Example 17

A nested array field with dragAndDrop enabled.

© 2019 Gitana Software, Inc.

Alpaca is sponsored by