Mowzer Mowzer - 1 year ago 200
Javascript Question

Getting iron-data-table to render demo data

When I run my code in this JSbin, I expect the

to render with populated data similar to the way it does on this demo page. Instead, only the table headers render but the rest of the cells fail to populate.

What changes can be made to the JSbin to achieve the desired behavior?,console,output

<!DOCTYPE html>
<base href="">
<link rel="import" href="polymer/polymer.html">

<script src="webcomponentsjs/webcomponents-lite.min.js"></script>

<link rel="import" href="iron-ajax/iron-ajax.html">
<link rel="import" href="paper-button/paper-button.html">

<link href="" rel="import">

<dom-module id="x-foo">
<paper-button on-tap="msg">Click Me</paper-button>

<iron-ajax auto
<iron-data-table selection-enabled items="[[users.results]]">
<data-table-column name="Picture" width="50px" flex="0">
<img src="[[item.user.picture.thumbnail]]">
<data-table-column name="First Name">
<data-table-column name="Last Name">
<data-table-column name="Email">

'use strict';
is: 'x-foo',
msg: function() {
console.log('This proves Polymer is working!');

Answer Source

Your problem is the import of the iron-data-table. Just using rawgit won't do the magic, since you need to use a proxy server such as polygit to make webcomponents work (you're already loading Polymer like this, but not iron-data-table).

Due to a mediocre documentation it took me a while to figure out, how to combine the polymer import with the iron-data-table.

The two configurations needed are polymer+:master and iron-data-table+Saulis+:master.

Combined, your base tag looks like this:

<base href="">

With this, you can import the element just like the others:

<link rel="import" href="iron-data-table/iron-data-table.html">

Working JSbin (Tested in Google Chrome)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download