Adding an '@ index' to pdfAddPageItem
-
Hi
I have this code where I'm looping through an array of data:
{{#each assumptions.operatingProfile.leaseOperation }} <div class="timeline__global tg__color-{{ 0 }}"> <h2 class="mb-2">Lease {{ 0 }}</h2> {{{pdfAddPageItem subSections="Lease {{0}} - Contracted" subSectionsClass="toc__bold"}}} .... .... etc. .... {{/each}}
When I render the table of contents, it seems that the
{{0}}
in thepdfAddPageItem
is not parsed. The{{0}}
in the<h2>
tag works well, though. Here's a sample section of how my table of contents is coming:Edits...................................................................................3
Operating...........................................................................4
Lease {{0}} - Contracted.........................................4
Operating Profile...............................................................4
Workscope........................................................................4
Lease {{0}} - Contracted.........................................4
Operating Profile...............................................................4
Workscope........................................................................5
Non-Leased Operator.......................................................6Is there any optimal way I can pass the value to the attribute
subSections="Lease {{0}} - Contracted"
?Many thanks in advance!
-
This is not how the handlebars work. Handlebars doesn't evaluate the expression in here
subSections="Lease {{0}} - Contracted"
because it is a plain string value passed as an argument to the helper.You can implement a helper that will do the replacement for you and prepare the value of
subSections
.
Like here
https://playground.jsreport.net/w/anon/_wQ~5bVn
However there are other approaches you can take, this is just an inspiration
-
Hi @admin ... that worked nicely. Thanks very much for the pointer.