Showcase - Stock Report - Header-Footer read from req.data



  • Hi Team,

    I am learning from the Showcase - Stock Report.... I notice that the header-footer are showing value defined in group .e.g {{group.fullName}}

    Can header-footer actually refer to data in req.data directly, or defining group is the only way to pass information to header-footer template?

    Thank you very much.



  • The input data on pdf-utils operation are the same as in the original request
    https://jsreport.net/learn/pdf-utils#input-data



  • Hum... even when the data is prepared in a script function beforeRender(req, res) dynamically?

    If my data is defined like this. My attempt to show {{eso_no}} in header template does not work.
    req.data = {
    "eso_no": "HAL-1600218",
    "versionDate": versionDate,
    "tShipper": tShipper,
    "items": result
    }

    However, if I create a group in the main template.
    {{{pdfCreatePagesGroup eso_no=eso_no versionDate=versionDate}}}
    then I can show {{group.eso_no}} in the header template.

    Thank you.



  • Please try to create a minimal playground example replicating your issue.



  • Thank you Sir. Here it is.
    https://playground.jsreport.net/w/harrisonleong/ezCxmDCa

    In the header-footer template, the group information can be shown but not the element in req.data.
    So the testing below cannot get the value {{eso_no}}

    Submission No : {{group.eso_no}}<br>
    Testing No : {{eso_no}}<br>



  • O... I found the answer... it has to be {{../eso_no}}

    Thanks!


Log in to reply
 

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