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

Fix incorrect row count on nested subforms #22757

Merged
merged 2 commits into from
Nov 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions media/system/js/subform-repeatable-uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
// check rows container
this.$containerRows = this.options.rowsContainer ? this.$container.find(this.options.rowsContainer) : this.$container;

// last row number, help to avoid the name duplications
this.lastRowNum = this.$containerRows.find(this.options.repeatableElement).length;

// To avoid scope issues,
var self = this;

Expand Down Expand Up @@ -152,10 +149,8 @@
var group = (typeof _group === 'undefined' ? $row.attr('data-group') : _group),
basename = (typeof _basename === 'undefined' ? $row.attr('data-base-name') : _basename),
count = (typeof _count === 'undefined' ? 0 : _count),
countnew = Math.max(this.lastRowNum, count),
groupnew = basename + countnew;
groupnew = basename + count;

this.lastRowNum = countnew + 1;
$row.attr('data-group', groupnew);

// Fix inputs that have a "name" attribute
Expand Down
2 changes: 1 addition & 1 deletion media/system/js/subform-repeatable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.