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

Use form.children|length to set data-num-items in collection_row block #6160

Closed
wants to merge 1 commit into from

Conversation

pavol-tuka
Copy link
Contributor

Relevant code:

{% set row_attr = row_attr|merge({
    ...
    'data-allow-add': allow_add ? 'true' : 'false',
    'data-allow-delete': allow_delete ? 'true' : 'false',
    'data-num-items': form.children is empty ? 0 : max(form.children|keys),    <<< THIS LINE
    ...
}) %}

Consider form.children equals to:
image

Current implementation sets attribute data-num-items to 0, beacuse thats max key, but 1 is correct.

@pavol-tuka
Copy link
Contributor Author

Related #4663, closing for now.

@pavol-tuka pavol-tuka closed this Feb 22, 2024
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

Successfully merging this pull request may close these issues.

1 participant