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

Collection 'add an item' button not working #39

Open
enriquekreuk opened this issue Apr 6, 2023 · 0 comments
Open

Collection 'add an item' button not working #39

enriquekreuk opened this issue Apr 6, 2023 · 0 comments

Comments

@enriquekreuk
Copy link

Umbrella version affected

6.4

Description

When there is one or more one-to-many relation in a collection, the button 'add an item' does not have an add event anymore. The first child event still works and adds a new a entry and also a new entry for the parent. The other child add button works as it should be.

If there are no entries in the collection the add buttons works fine. But if you have at least one entry in the collection (and it is saved and re rendered server-side) it is broken.

I have added a one to many relation in the demo as example. See the gif in the additional context field what happens when you try to add a new entry.

What likely the problem is that de querySelector search for the first button. But when there is already an other button rendered earlier on in the HTML tree, the parent button is not found.

function o() {
                var e;
                return function(e, t) {
                    if (!(e instanceof t))
                        throw new TypeError("Cannot call a class as a function")
                }(this, o),
                (e = i.call(this))._prototype = e.dataset.prototype,
                e._prototype_name = e.dataset.prototypeName,
                e.index = parseInt(e.dataset.index),
                e.maxLength = parseInt(e.dataset.maxLength),
                e.sortable = "true" === e.dataset.sortable,
                e.addAction = e.querySelector(".js-add-item"),
                e.deleteActions = e.querySelectorAll(".js-del-item"),
                e.itemsContainer = e.querySelector(".js-item-container"),
                e
            }

How to reproduce

Create a one-to-many in a UmbrellaCollection and try to use the add button. when you have at least one entry in the collection.

Additional Context

out

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