Global helper breaking changes

  • After upgrading from v2 to v3 this was one of the breaking changes to our templates, I'm not exactly sure if now the global helper content is only meant for template content and a module for the template script (if we want) OR if there's another way around
    I couldn't find any reference about the helpers in the v3 migration byt shared helpers are not accessible anymore on both template content and template script, we can access the new asset script on the template content but not anymore on the template script.
    From what I've seen in some playground examples, we need to export the functions from and import them on the template script

    Here's the example i'm referencing ( If we attempt to use toUpperCase inside the template script, that will throw an error

  • There should be no breaking changes in the assets for v2->v3 update.
    Could you share your v2 workspace by emailing the export to me?

    the new asset script on the template content but not anymore on the template script.

    I'm not sure what you mean with the template script? Could you elaborate? Thank you

  • @jan_blaha So what I mean given the referenced playground is when we attempt to use a function created inside the global helper js such as toUpperCase in that given example it does not work as expected. The template name main contains some js code for its template that loads sum function from mymodule but if you attempt to use toUpperCase it will not work
    If this doesn't help i can definitely build a repro

  • I think I get it now. You want to use something like this in your template content.

       var = toUpperCase('aaaa')

    However, this was never working also in v2.

    The shared helper assets will add templating engine helpers. So the functions you can use as helpers {{toUpperCase "aa"}}

    What am I missing?

  • I don't want to use it on the template content, there we use handlebars syntax, and works perfectly, i want to use it on the javascript attached to that template helpers/script (not sure exactly what name i should assign it but its the generated helpers.js file)

  • That's correct

  • Thank you. I see, yes that should work. We will check whats the issue.

    I apologize for the problems.

  • No worries, i wanted to confirm first with JSReport team to be sure if there's a new way that was introduced or if this was actually a bug
    Thanks for the fast reply btw :)

  • This should be now fixed in the jsreport 3.2.0

  • @jan_blaha After testing the new version it seems to be fixed, thanks

  • Excellent! Thank you for the confirmation.

Log in to reply

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