0

I want to: Generate a table that has tickboxes.

I generate a table's code from JS, then I change the innerHTML of a parent node to include it.

If I call componentHandler.upgradeElement on the , I get this: Called upgradeElement on the <table>

As you can see, there is also the order messed up!

If I call componentHandler.upgradeElement on nothing, this happens: enter image description here

How do I upgrade the whole table? The table has mdl-data-table--selectable class...

The performance is not absolutely crucial.

tensojka
  • 302
  • 1
  • 5
  • 20

2 Answers2

0

Did you try calling upgradeDom?

componentHandler.upgradeDom();
K.A.D.
  • 3,648
  • 3
  • 34
  • 35
0

mdl-data-table--selectable seems to be deprecated.

From the Material Design Lite site:

There are numerous issues with the implementation and adding in support to handle these problems will only add a good portion of complexity to a component that is otherwise very simple. If you are currently using mdl-data-table--selectable then this will affect you. The recommended alternative is for developers to create the checkboxes on their own.

This solved the issue of disappearing checkboxes at least for me. Be aware that you have to implement the "select all" functionality manually.

sdfx
  • 21,653
  • 4
  • 26
  • 34