Is it possible to generate a table in a template t...
# suitecommerce
r
Is it possible to generate a table in a template to display the attributes of an array of objects provided in the getContext function of a view? I was trying to utilize Custom Helper functions provided in the HandlebarsExtras.js file, but these seem to only apply to models and collections of data
p
use {{#each}} to iterate on arrays of objects. inside the iterator you can call the object properties. {{#each artists}} <tr> <td>{{name}}</td> <td data-something="{{../something}}">{{age}}</td> </tr> {{/each}} mind the switch in context inside an each and how "this" becomes the object that is iterated over.
and how to go back to the previous context with ../
r
thanks @PabloZ, I was looking at this in the Handlebars.js documentation and got this working for accessing attributes within my objects in the array