Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested repeater setList not working when outer repeater has no fields other than the nested repeater #179

Open
iThom96 opened this issue Sep 25, 2023 · 0 comments

Comments

@iThom96
Copy link

iThom96 commented Sep 25, 2023

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" }]
  }
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant