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

Working with a dynamic Stepper component #61

Open
arist0tl3 opened this issue Feb 9, 2017 · 1 comment
Open

Working with a dynamic Stepper component #61

arist0tl3 opened this issue Feb 9, 2017 · 1 comment

Comments

@arist0tl3
Copy link

I know this is outside of the scope of this project currently, but I think the Stepper component is a big value add, and making it work with meteor-mdl seems pretty straightforward.

I'm working with https://github.com/ahlechandre/mdl-stepper, and have things working well with auto-upgraded stepper components.

However, I'm doing something like this:

<ul class="mdl-stepper">
  {{#each steps}}
    <li class="mdl-step">
      <span class="mdl-step__label">
        <span class="mdl-step__title">
          <span class="mdl-step__title-text">{{name}}</span>
        </span>
      </span>
      <div class="mdl-step__content">
      </div>
      <div class="mdl-step__actions">
        <button data-stepper-continue>Continue</button>
      </div>
     </li>
  {{/each}}
</ul>

When I add steps dynamically, I need to re-upgrade the stepper. I tried using componentHandler.upgradeAllRegistered(); as well as componentHandler.upgradeDom(); and also the MDl versions of those functions. No dice.

What did work was componentHandler.downgradeElements(document.querySelector('.mdl-stepper'));, which seems to trigger the listener for autoupgrades in meteor-mdl.

I ended up with this attached to the click handler that inserts new steps:

Meteor.setTimeout(function () {
      componentHandler.downgradeElements(document.querySelector('.mdl-stepper'));
    }, 100);

Just wondering if there is a better way to do this?

@Zodiase
Copy link
Owner

Zodiase commented Apr 4, 2017

I guess what you need is to prevent mdl from auto upgrading anything inside class="mdl-stepper"?

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

2 participants