Material Design Lite Table - adding dynamic line breaks

This is the markup for the checkbox using material-design-lite:

<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox">
  <input type="checkbox" id="checkbox" class="mdl-checkbox__input" />
  <span class="mdl-checkbox__label">Checkbox</span>
</label>

The problem is that the labels for are connected to the id inputs .

Therefore, when I add a dynamically new checkbox, I must also add id. But how do you know which identifier to add? Isn't that a problem when I'm going to add these rows to the database later?

Here is a working example:

http://codepen.io/anon/pen/QjNzzO

Pay attention to the flag of the new task to be added.

+1
source share
4 answers

, . componentHandler.upgradeDom() componentHandler.upgradeElement().

http://codepen.io/pespantelis/pen/pjbvBL

+3

. coffeescript jade

componentHandler.upgradeElements(el). , , , , lastChild. , componentHandler.upgradeElement(el) componentHandler.upgradeElements(el), , , dom.

id $index. , , , ( ).

http://codepen.io/anon/pen/dYMBqj?editors=101

+2

Material Design Lite , MDL, . , DOM, , upgradeElement.

, :

componentHandler.upgradeAllRegistered();

http://www.getmdl.io/started/index.html#dynamic

?

+2

componentHandler.upgradeElement(el) DOM. vue.js, , , .

+1

Source: https://habr.com/ru/post/1610574/


All Articles