Include JavaScript Library in your Intrexx Application

As most of the people I also don’t like to reinvent the wheel. This is why, when I have to code something, I try to use existing, usually even free, code libraries to work with. Since most of them are also open source, I can be pretty sure they are of high quality and used and tested very often.

In Intrexx you can include two types of external libraries. Java libraries as well as JavaScript libraries. In this post I will show you how to include a JavaScript library in Intrexx and how to include the library in the application package, so that it will be exported and later imported together with the rest of the package.

Download or Create a Library

First of all we need an existing library to start with. I’m going to introduce several JavaScript libraries in later posts. That’s why for now I use a JavaScript of my own, to show you how including an external- library in your Intrexx application works.

So this is the script myExternalLibrary.js

Find a location

The JavaScript file needs to be accessible from the browser. This means any JavaScript files need to be placed underneath in the portals /external/htmlroot/ directory. Custom JavaScript files are usually placed in the /external/htmlroot/includes/custom folder. This way they are available to multiple applications and can be found and maintained more easily. If the JavaScript files are shipped with an application, they automatically will be placed under the /external/htmlroot/include/<application-guid> folder.

Add the library to your application-package

If you want to ship the library with your application, Intrexx offers the possibility to add it to your application-package. To achieve this, simply add the JavaScript file to the application from within the application designer. You can do this by opening the details-page of your application. On the bottom of the first tab there is the Link Open temporary working directory. This link opens an explorer-window with the applications file structure in it. Here you can add the JavaScript file to the “include” folder. After publishing the application the file will be automatically added to the folder /external/htmlroot/include/<application-guid>.

Include the library in your application’s JavaScript

Since the file is available , let’s include it in an application JavaScript.

First the browser needs to load the library’s JavaScript file. Intrexx offers a method in its own API to do this. This method is also part of the Intrexx JavaScript snippet-library, inside the JavaScript editor. After loading your JavaScript file, methods of the library can already be called.

 

 

 

Martin Weber on EmailMartin Weber on Facebook
Martin Weber
Consultant at United Planet
Since April 2014 I'm working in the Consulting Services department at United Planet in Freiburg, Germany. My tasks there include holding Intrexx seminars, develop and customize customer-applications and in general find solutions for all kinds of problems using Intrexx. Also I forward bugs and feature-requests to our development department in order to further develop Intrexx.
Additionally to that I'm very active in United Planet's community forum and answer a lot of questions asked by customers or partners of United Planet.

1 thought on “Include JavaScript Library in your Intrexx Application

Leave a Comment