Open iThom96 opened 1 year ago
Example:
<form class="outer-repeater"> <div data-repeater-list="outer-group" class="outer"> <div data-repeater-item class="outer"> <input data-repeater-delete type="button" value="Delete" class="outer" /> <!-- When i remove this line the setList method no longer works --> <input type="hidden" name="text-input" value="A" class="outer" /> <div class="inner-repeater"> <div data-repeater-list="inner-group" class="inner"> <div data-repeater-item class="inner"> <input type="text" name="inner-text-input" value="B" class="inner" /> <input data-repeater-delete type="button" value="Delete" class="inner" /> </div> </div> <input data-repeater-create type="button" value="Add" class="inner" /> </div> </div> </div> <input data-repeater-create type="button" value="Add" class="outer" /> </form>
var $outerRepeater = $(".outer-repeater").repeater({ isFirstItemUndeletable: true, repeaters: [ { selector: ".inner-repeater", isFirstItemUndeletable: true } ] }); $outerRepeater.setList([ { "inner-group": [{ "inner-text-input": "set-a" }] }, { "inner-group": [{ "inner-text-input": "set-b" }] } ]);
Example: