How to use each loop in header pdf util



  • Hello @jan_blaha @bjrmatos
    Hope you are doing well,

    I have candidate array and need data from each candidates in header pdf util. How can I achieve that?
    I have tried below technique, this is the right way to do this? because I need more data in header so Do I need to create functions each time?
    https://playground.jsreport.net/w/happypatel20/EjqIq16V

    Can you suggest any other option for the same?

    I have tried each loop in header file but it is not working as expected.

    Thanks!


  • administrators

    hi @Happy-Patel

    it looks your code is the right way, there are multiple ways you can simplify it, one way is that instead of adding pdf page item per property value, you just use a single call with all the properties. then in the header you are sure your data is in the 0 index, and can create just a single function for all your properties access.

    if you need to conditionally render something based on the avatar you can still do it in the header, from the main you can just propagate the avatar value (without the if) no matter if it is undefined or not

    here is a demo
    https://playground.jsreport.net/w/anon/EoeNYCW3


Log in to reply
 

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