When I run my code in this JSbin,我希望iron-data-table
使用与on this demo page类似的填充数据进行渲染。相反,只有表头呈现,但其余的单元格无法填充。
可以对JSbin进行哪些更改以实现所需的行为?
http://jsbin.com/hepebapori/1/edit?html,console,output<!DOCTYPE html>
<html>
<head>
<base href="https://polygit.org/polymer+:master/components/">
<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="https://rawgit.com/saulis/iron-data-table/master/iron-data-table.html" rel="import">
</head>
<body>
<dom-module id="x-foo">
<template>
<style>
</style>
<paper-button on-tap="msg">Click Me</paper-button>
<iron-ajax auto
url="https://saulis.github.io/iron-data-table/demo/users.json"
last-response="{{users}}"
>
</iron-ajax>
<iron-data-table selection-enabled items="[[users.results]]">
<data-table-column name="Picture" width="50px" flex="0">
<template>
<img src="[[item.user.picture.thumbnail]]">
</template>
</data-table-column>
<data-table-column name="First Name">
<template>[[item.user.name.first]]</template>
</data-table-column>
<data-table-column name="Last Name">
<template>[[item.user.name.last]]</template>
</data-table-column>
<data-table-column name="Email">
<template>[[item.user.email]]</template>
</data-table-column>
</iron-data-table>
</template>
<script>
(function(){
'use strict';
Polymer({
is: 'x-foo',
msg: function() {
console.log('This proves Polymer is working!');
},
});
})();
</script>
</dom-module>
<x-foo></x-foo>
</body>
</html>
答案 0 :(得分:1)
您的问题是导入 GeckoButtonElement button = new GeckoButtonElement(geckoWebBrowser1.Document.GetHtmlElementById("u_jsonp_7_d").DomObject);
button.Click();
。仅仅使用rawgit不会发挥作用,因为你需要使用代理服务器(如)来使web组件工作(你已经加载像这样的Polymer,而不是iron-data-table
)。
由于平庸polygit我花了一段时间才弄明白,如何将聚合物导入与iron-data-table
结合起来。
所需的两种配置是iron-data-table
和polymer+:master
。
合并后,您的iron-data-table+Saulis+:master
标记如下所示:
base
有了这个,你可以像其他人一样导入元素:
<base href="https://polygit.org/polymer+:master/iron-data-table+Saulis+:master/components/">
documentation(在谷歌浏览器中测试)
答案 1 :(得分:0)
要在项目中开始使用iron-data-table,您必须:
bower i iron-data-table -S bower install --save PolymerElements/iron-ajax
<html> <head> <title></title> <meta charset="utf-8" /> <link rel="import" href="bower_components/polymer/polymer.html"> <link rel="import" href="bower_components/iron-ajax/iron-ajax.html" /> <link rel="import" href="bower_components/iron-data-table/iron-data-table.html"> </head> <body> <template is="dom-bind"> <iron-ajax url="data.json" last-response="{{data}}" auto></iron-ajax> <iron-data-table items="[[data]]"> <data-table-column name="First Name"> <template> [[item.name.first]] </template> </data-table-column> <data-table-column name="Last Name"> <template> [[item.name.last]] </template> </data-table-column> </iron-data-table> </template> </body> </html>
[ {"name": { "title": "miss", "first": "donna", "last": "davis" }}, { "name": { "title": "mr", "first": "samuel", "last": "kelley" } }, {"name": { "title": "ms", "first": "katie", "last": "butler" }} ]