Juicy / juicy-table-repeat

A workaround custom element which allows you to use dom-repeat inside table under IE and FF
MIT License
4 stars 1 forks source link
frozen polymer

<juicy-table-repeat>

This is a workaround custom element to support <template is="dom-repeat"> in <table> under IE. Will not be required after this Polymer issue is fixed: https://github.com/Polymer/polymer/issues/1567

Install

Install the component using Bower:

$ bower install Juicy/juicy-table-repeat --save

Or download as ZIP.

Usage

  1. Import Web Components' polyfill, if needed:

    <script src="https://github.com/Juicy/juicy-table-repeat/raw/master/bower_components/webcomponentsjs/webcomponents.min.js"></script>
  2. Import Custom Element:

    <link rel="import" href="https://github.com/Juicy/juicy-table-repeat/blob/master/bower_components/juicy-table-repeat/juicy-table-repeat.html">
  3. Start using it!

Instead of following code:

  <table>
      <thead>
      <!-- your favorite thead -->
      </thead>
      <tbody>
      <template is="dom-repeat" items="{{model.Shops}}">
          <tr>
              <td>{{item.Name}}</td>
              <!-- other item stuff -->
          </tr>
      </template>
      </tbody>
  </table>

Use this:

<juicy-table-repeat rows="{{model.Shops}}">
    <table>
      <thead>
      <!-- your favorite thead -->
      </thead>
      <tbody>
      </tbody>
    </table>
    <template is="dom-template" class="row-template">
        <table>
            <tr>
              <td>{{item.Name}}</td>
              <!-- other item stuff -->
            </tr>
        </table>
    </template>
</juicy-table-repeat>

Observing changes

Note: juicy-table-repeat observes changes in the rows array, but re-rendering HTML table might be expensive.

Options

Attribute Options Default Description
rows Array The array of objects to iterate over.

Contributing and Development

History

For detailed changelog, check Releases.

License

MIT