How do I call a component via its' shortid?



  • I can not sucessfully call a component via its' shortid. How should the syntax be for this?

    I have a helper for finding the correct component. The component call looks like this. I simply replaced the name parameter with shortid, but this was maybe too naive.

     return component.call({
        ...this,
        someData: 'bla bla',
      }, shortid, options)
    


  • Hmm, this wasn't implemented in the old V2 syntax. Maybe it's not implemented in V3 either?
    https://github.com/jsreport/jsreport/issues/506

    I strongly vote for this feature. I'm building a quite advanced concept with components (BTW. I love them). The origin for my component structures resides in a database. I would rather not rely on component names and locations, since this is not at all as reliable as real keys, i.e. shortid. If I refer to my components via name and location I could breaka a template just my moving or renaming a component.



  • We will consider it...

    You can implement your own helper rendering components by shortid
    https://playground.jsreport.net/w/anon/T0y7ehaB



  • That's great!
    I was looking for an API like this, figured it should exists somewhere.

    Is there any documentation for tha jsreport-APIs?


Log in to reply
 

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