Thats working fine!
Thank you!
M
manuel-iot
@manuel-iot
0
Reputation
2
Posts
94
Profile views
0
Followers
0
Following
Posts made by manuel-iot
-
RE: Using async helper functions with #each in jsreport Handlebars
-
Using async helper functions with #each in jsreport Handlebars
Hello,
I'm trying to use an async helper function inside a Handlebars #each block within a jsreport component. Here’s my test case:
{{#each (getSyncItems)}} <p>{{this}}</p> {{/each}} {{#each (getAsyncItems)}} <h2>{{this}}</h2> {{/each}}
function getSyncItems() { console.log("getSyncItems"); return ["sync1","sync2"]; } async function getAsyncItems() { console.log("getAsyncItems"); return ["async1","async2"]; }
The synchronous function (getSyncItems) works as expected, but the asynchronous function (getAsyncItems) does not render any output when used inside #each.
Since I plan to use JSONata to query data in my actual implementation, I need to call jsonata.evaluate(), which is asynchronous.
Question:
Is there a way to use async helper functions inside #each in jsreport Handlebars? If not, what would be the best approach to handle this scenario?Thanks!
br Manuel