Hello,

i needed to add externel Javascript libraries into one of our Fiori applications. It took me some time to figure out how this could be achived, as eg. jQuery.sap.loadScript() didn’t properly call the defined callback function. So here comes a working example – i know d3 is already included within sapui5, but i’ve needed another version as shipped in sapui5. This works also with other external js libraries.

jQuery.sap.registerResourcePath(“d3”, “../extjslib/d3”);

jQuery.sap.require(“d3”);

Have a nice day & kind regards,

Michael

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Christian Guenter

    Hi Michael,

    where do place the call to

    jQuery.sap.registerResourcePath(“d3”, “../extjslib/d3”);

    jQuery.sap.require(“d3”);

    in your Fiori-App?

    Regards Christian

    (0) 
      1. Basavaraja Goudar

        Hi Michail,

        Below is the screen of my project, I am developing a custom fiori app and launchpad for accessing the custom app. We need client side pdf generation so we are trying to include third party library marked in blue to accomplish the requirement.

        Please provide code or steps to include these files using component.js.

        I am aware of including third party library index.html, as are not using index we need component.js route of including these files.

        your reply is much appreciated!

        projectSC.png

        Regards,

        BG

        (0) 
  2. Krishna Kishor Kammaje

    It is better to use sap.ui.define instead of jQuery.sap.require as a best practice.


    Also other approach is to include it in Component.js in “includes” parameter under “metadata”.

    (0) 

Leave a Reply