[英]Jsreport how to fill the table with data
im trying to to fill a table with data to export it in pdf using jsreport but i couldnt manage to do it .我试图用数据填充表格以使用 jsreport 将其导出为 pdf,但我无法做到。 This is the html file :
这是html文件:
<h1>test{{test}}</h1>
<table class='table striped'>
<thead>
<tr>
<th>OrderID</th>
<th>ShipAddress</th>
<th>ShipCity</th>
<th>ShipCountry</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{items.order}}</td>
<td>{{items.addr}}</td>
<td>{{items.city}}</td>
<td>{{items.country}}</td>
</tr>
</tbody>
</table>
And this is the data :这是数据:
{
"items": [
{
"order": "65854",
"addr": "test 1",
"city": "2fc2",
"country": "2fc2"
},
{
"order": "75757",
"addr": "azerty",
"city": "2fc2",
"country": "2fc2"
},
{
"order": "65575784",
"addr": "tst",
"city": "2fc2",
"country": "2fc2"
}
]
}
I've tried a lot of things but i couldnt manage to do it.我已经尝试了很多事情,但我无法做到。
you must use你必须使用
<h1>test{{test}}</h1>
<table class='table striped'>
<thead>
<tr>
<th>OrderID</th>
<th>ShipAddress</th>
<th>ShipCity</th>
<th>ShipCountry</th>
</tr>
</thead>
<tbody>
{{#each items}}
<tr>
<td>{{order}}</td>
<td>{{addr}}</td>
<td>{{city}}</td>
<td>{{country}}</td>
</tr>
{{/each}}
</tbody>
</table>
https://jsreport.net/learn/handlebars https://jsreport.net/learn/handlebars
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.