Focal Point
Problem in loading jquery js files in html report

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9877008236

August 13, 2013, 12:03 PM
santu
Problem in loading jquery js files in html report
Hi All,

I am working on jquery integration with webfocus.

To include jquery js file to html report I have given as below and Jquery is working fine.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js">
<script src="https://datatables.net/release-datatables/media/js/jquery.dataTables.min.js">

As per my requirement i should not use the js files from outside sites. So, I have downloaded the js files from above links and copied to others folder in my application and imported the js files by giving below syntax but jquery is not loading when i give below syntax in my html report.

<script id=item1 src="app/jquery.js">
<script id=item1 src="app/jquery_ui_min.js">
<script id=item1 src="app/jquery_datatables_min.js">

Can anyone tell me, am i missing something?
Is there any particular place to mention the script tags?(I am giving in head tag)
Is there any function to load the javascript in webfocus?

thanks in advance..


Web FOCUS 7.7.03
PDF
August 13, 2013, 12:37 PM
njsden
Santu, the "src" attribute in the <script> tag must have a value that represents a valid URI.

You are using a value of "app/jquery.js" which is likely not being resolved properly by your web and/or application server. For instance, if you use IIS, do you have an "app" virtual directory declared there?

My suggestion would be to place those files in a location accessible to your webserver; for instance, when the WebFOCUS Client is installed, an "apps" folder is created (i.e. C:\ibi\apps) and an "approot" virtual path is created on the webserver for you. that is true for example if you use IIS and proceeded with a "default" installation.

Anyway, this is something you can try:

1) Create a new folder called "js" instead of the "apps" folder in the server/host where your WebFOCUS Client is installed, and place a copy of your .js files there. for illustration purposes, you'd end up with something that looks like this:

C:\ibi\apps\js\jquery.js
C:\ibi\apps\js\jquery_ui_min.js
C:\ibi\apps\js\jquery_datatables_min.js

You may also go as far as to place your CSS in a similar container as well:

C:\ibi\apps\css\jquery_ui_min.css
C:\ibi\apps\css\jquery_datatables_min.css

2) Verify that you can access those resources. The easiest way is just to open a new browser and use something like this:

http://webfocusclienthostnameh...approot/js/jquery.js

If that works (which I expect will) then you're in business.

3) Manually update your <script> tags in the HTML document to look like this:

<script id="item1" src="/approot/js/jquery.js">
<script id="item2" src="/approot/js/jquery_ui_min.js">
<script id="item3" src="/approot/js/jquery_datatables_min.js">


And that's it!

Another approach would be do it the "MRE" way, which allows you to import css/js resources into the MRE itself via HTML Composer; if you do it that way though, be aware of the fact that the <script> tags may look slightly different as they have to have a custom URI reference that can be resolved into valid MRE resources at runtime (you may see an attribute called rtFileName instead of src, for instance) but that should be okay as HTML composer maintains that automatically for you.

The only caveat to that approach is that your js/css files will end up being copied over to each MRE Domain where you need to use them, so if you plan on upgrading/patching your js/css resources, you'll have to maintain multiple copies of it. Not my preferred approach which is why I suggested something slightly different above.


Hope this helps.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
August 14, 2013, 02:20 PM
Twanette
Hi Santu,
I don't if it was intentional - but the filenames of your js files don't match in the two code samples.
Check the spelling & case sensitivitye.g. Upper vs lower-case.


WebFOCUS 8.2.06 mostly Windows Server