Repeat Control
- baba baloul (Unlicensed)
- Pankil Dave
- James Ngo
Owned by baba baloul (Unlicensed)
Introduction
Added since CoreJS 7.1.0.
Part of CoT Form, allows a set of fields to be made available multiple times.
To add the repeat control to a CoT Form you add it inside the sections.rows array object.
"sections" : {
"rows": [
"repeatControl": {
//define repeat control. Note the name of the of repeatControl element is case sensitive.
}
]
}
Configuration
Option | Type | Description |
---|---|---|
Basic Configuration | ||
id | string | Repeat control element's ID. |
title | string | Adds a title to the repeat control. It is rendered inside an H4 element. |
className | string | Class name added to the repeat control element's class name. Default to "col-xs-12". |
bindTo | string | The Backbone model's attribute name used when using the CoT Form's setModel method. |
Repeat Control Sets Configuration | ||
setTitle | string | Adds a title to each repeat control set. It is rendered inside an H5 element. |
setClassName | string | Class name added to each repeat control set element's class name. |
rows | Object[] | Row definition. Same as CoT Form's row definition except it doesn't support "Repeat Control" field. |
rows[].fields | Object[] | Field definition. |
rows[].grid | Object | "Grid" field definition. |
initial | number | The initial number of sets to display. If empty its default to "min", if less than "min" it takes the value of "min", if "max" is not -1 and more than "max" it takes the value of "max". |
min | number | The minimum number of sets allowed. Default to 0. |
max | number | The maximum number of sets allowed. The value of -1 results in no maximum limit. Default to -1. |
Add Button Configuration | ||
addClassName | string | Class name added to each add button container elements. |
addBtnClassName | string | Class name added to each add buttons. Default to "btn-default". |
addBtnGlyphicon | string | Bootstrap 3's Glyphicons class name. Default to "glyphicon-plus". |
addBtnLabel | string | Add button's label. Defaults to 'Add row' + repeat control title. |
addBtnOnClick | function | Callback triggered when the add button is clicked and a new set is rendered. |
Remove Button Configuration | ||
removeClassName | string | Class name added to each remove button container elements. |
removeBtnClassName | string | Class name added to each remove buttons. Default to "btn-default". |
removeBtnGlyphicon | string | Bootstrap 3's Glyphicons class name. Default to "glyphicon-minus". |
removeBtnLabel | string | Remove button's label. Defaults to 'Remove row' + repeat control title. |
removeBtnOnClick | function | Callback triggered when the remove button is clicked and an existing set is removed. |
Form Definition
var formDefinition = { ... sections[{ ... rows[{ ... repeatControl: { id: 'REPEAT_CONTROL_ID', title: 'REPEAT_CONTROL_TITLE', className: 'CLASSNAME', rows: [{ fields: [{ id: 'FIELD_01', title: 'Field 1' }, { id: 'FIELD_02', title: 'Field 2' }] }, { fields: [{ id: 'FIELD_03', title: 'Field 3' }] }] } }] }] }
Page Tree