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
MaterialMenu use on dynamic website #855
Comments
Poking around some of the code and reading other issues, the following will make a menu work on a dynamic set up. componentHandler.upgradeDom('MaterialMenu', 'mdl-menu'); Although not specific to the added element, it is a current work around for cases where the behaviour is breaking an application. |
If you could provide a codepen of the exact setup that isn't working that would be great. It is kinda hard to walk through what the component handler is doing in different situations, especially with menu which I have yet to debug at all. |
I've experimented further with the placement of where I am calling the upgrade and I can confirm that I've got it working now so will close the issue. |
As a follow up, I believe in its current state if you are not using upgradeDom, then you would have to upgrade each. |
Currently, only upgrading the I think when needing to upgrade various elements, probably some kind of loop through an upgrade map could be a suitable solution or being able to pass in DOM fragments to |
Overview of the Issue - if an error is being thrown a non-minified stack trace helps
Use of
MaterialMenu
in dynamic context I believe currently has a bug or needs a little documentation to clarify usage steps.I'm not one 100% that I have the right approach but I am utilising
componentHandler.upgradeElement
on theul
element being used to store the menu.On inspecting the DOM, it seems to be modified correctly as intended. However, the button used to open/close the menu seems to no longer be wired up. My assumption was that upgrade using
MaterialMenu
would search for the element with ID stated in thefor
attribute.Is there a requirement to upgrade the button element also?
@jh3y
The text was updated successfully, but these errors were encountered: