Estoy tratando de llenar una tabla con datos para exportarla en pdf usando jsreport pero no pude hacerlo. Este es el archivo 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>Y estos son los datos:
{ "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" } ] }He intentado un montón de cosas, pero no pude lograr hacerlo.
debes usar
<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>