Repeat Control

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

OptionTypeDescription
Basic Configuration
idstringRepeat control element's ID.
titlestringAdds a title to the repeat control. It is rendered inside an H4 element.
classNamestringClass name added to the repeat control element's class name. Default to "col-xs-12".
bindTostringThe Backbone model's attribute name used when using the CoT Form's setModel method.
Repeat Control Sets Configuration
setTitlestringAdds a title to each repeat control set. It is rendered inside an H5 element.
setClassNamestringClass name added to each repeat control set element's class name.
rowsObject[]Row definition. Same as CoT Form's row definition except it doesn't support "Repeat Control" field.
rows[].fieldsObject[]Field definition.
rows[].gridObject"Grid" field definition.
initialnumberThe 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".
minnumberThe minimum number of sets allowed. Default to 0.
maxnumberThe maximum number of sets allowed. The value of -1 results in no maximum limit. Default to -1.
Add Button Configuration
addClassNamestringClass name added to each add button container elements.
addBtnClassNamestringClass name added to each add buttons. Default to "btn-default".
addBtnGlyphiconstringBootstrap 3's Glyphicons class name. Default to "glyphicon-plus".
addBtnLabelstringAdd button's label. Defaults to 'Add row' + repeat control title.
addBtnOnClickfunctionCallback triggered when the add button is clicked and a new set is rendered.
Remove Button Configuration
removeClassNamestringClass name added to each remove button container elements.
removeBtnClassNamestringClass name added to each remove buttons. Default to "btn-default".
removeBtnGlyphiconstringBootstrap 3's Glyphicons class name. Default to "glyphicon-minus".
removeBtnLabelstringRemove button's label. Defaults to 'Remove row' + repeat control title.
removeBtnOnClickfunctionCallback 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