0
私は1つの配列graphDataを持っています。今私はそれを印刷するためにdom-repeatを使いたいと思う。dom-repeatを介してDOM配列を出力する
<template is='dom-repeat' items='{{internalgraphData}}'>
<tr>
<td>{{item.asset}}</td>
<td>{{item.percentage}}%</td>
<td>{{item.investment}}</td>
<td>{{item.currentvalue}}</td>
<td class="u-value-align"><span class="red-text darken-4">{{item.gain}}</span></td>
<td><img src="../images/arrow-red.png"></td>
<td class="black-text"><a class="waves-effect waves-light btn white blue-text back" href="equity.html">Select</a></td>
</tr>
</template>
私のJSONは以下の通りです...私はそれが私が成功した地元のタグ - にJSONからデータを転送見えます、私はinternalgraphDataを印刷 「internalgraphData」タグ値以下でDOMリピート構造を作成しようとしました値構造体 "internalgraphData"
Polymer({ is: 'my-menu',
........
ready : function(graphid,graphData) {
this.graphData = [
['Equity', 50,25000,37000,240],
['Bonds', 35,12500,10000,-480],
['Alternates',5, 2000,2000,340],
['Cash',10,1000,1000,-140]
];
if (this.graphData.length > 0)
{
for(i = 0; i< this.graphData.length; i++)
{
this.internalgraphData.push({
"asset" : this.graphData[i][0],
"percentage" : this.graphData[i][1],
"investment" : this.graphData[i][2],
"currentvalue" : this.graphData[i][3],
"gain" : this.graphData[i][4]
});
}
しかし、dom-repeatは印刷されていません。 誰でも手助けをすることができますか?
注:私は明示的にタグ値を追加した場合...テーブルが来ている...ループでの操作上記
this.internalgraphData = [
/*['Equity', 50,25000,37000,240],
['Bonds', 35,12500,10000,-480],
['Alternates',5, 2000,2000,340],
['Cash',10,1000,1000,-140]*/
{asset: 'Equity', percentage: 50, investment: 25000, currentvalue: 37000, gain: 240 },
{asset: 'Equity', percentage: 35, investment: 12500, currentvalue: 10000, gain: -480 },
{asset: 'Equity', percentage: 5, investment: 2000, currentvalue: 2000, gain: 340 },
{asset: 'Equity', percentage: 10, investment: 1000, currentvalue: 1000, gain: -140 }
];