Widget to add and remove sub-widgets dynamically.
Install with component(1):
$ component install domachine/dynamic-rows
Initialize the widget.
el
is the container element to usetemplate
is the component/reactive template used to generate the rows
Insert a new sub-widget. If index
is given replace the element at
index
otherwise insert at index 0. Returns the newly created
DOMElement
. model
is an optional model to bind with reactive.
Append a new sub-widget. If index
is given append after the
element at index
. Returns the newly created DOMElement
.
model
is the same as in .insert()
.
Remove the element at index
. Returns the model stored at index
.
MIT