Render div id and call javascript on loop



  • Hi,

    In my input data I have a list with variable length, each element of this list is an input for a javascript function that renders a chart into a div tag of my template. In order to achieve this, for each element of my list I need the final html to have a div with an id, and call a javascript function with the same id.

    I solved it like this:
    https://playground.jsreport.net/w/jrodria/3LyvGIKn

    I had to assign an id to each chart in the input data. Is there a better way to solve this ?

    PS: Im using Jsrender


  • administrators

    hi! your solution looks good and makes sense. i think it is great because it is simple, easy to understand so i don't think there is a better way to do it, your solution is fine.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.