Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problems with Javascript Extension

Hello community,

could you please have a look at my extension. I try to use ThreeJS to create simple 3d objects. However I always get an infinite loop error (I have firebug activated) when moving or inserting an object on the sheet.

The code I use is from an example which runs without any erros in an html site.

My Javascript skills are limited so I'm guessing that something must be wrong in the code or how I use the code.

Thank you very much,

Thorsten

1 Solution

Accepted Solutions
Not applicable
Author

I got it!

The slash before "lib" and after ThreeJS works in the Desktop App but not on the server:

var template_path = Qva.Remote + "?public=only&name=Extensions/ThreeJS/";

Qva.LoadScript(template_path + '/lib/js/three.min.js', function () {

View solution in original post

9 Replies
Not applicable
Author

Gotta push this because I'm still stuck here.

tlorimier
Partner - Contributor III
Partner - Contributor III

I just check your script and something might be the cause : the way you load your script.

Qlik have some best practice extension sample where you can see how to load your external script in your extension.

You have to know that this function "Qva.AddExtension" is execute each time you move something, you click a filter etc .....

The problem with your extension is that you load your external ressource inside this function so QV will add again and again the script (that might be the cause of your loop).

You can put all your external script in your "function ThreeJS_Init() { ............ loadScript"

And before Qva.AddExtension("ThreeJS" ....

That will look something like that :

@

function ThreeJS_Init() {

Qva.LoadScript('https://getfirebug.com/firebug-lite-beta.js#startOpened=true');

Qva.LoadScript( ....)

    Qva.AddExtension("ThreeJS",

        function () {

Hope this help.

Not applicable
Author

Hello Thibaut,

thank you for your help. Now I mange to display the graph without errors on the desktop edition. However it disappears when I put in on the AcessPoint.

I attached the script.

Please have a look.

Thanks again.

tlorimier
Partner - Contributor III
Partner - Contributor III

Hi Thorsten,

Glad it helps you.

Maybe the problem is different.

Which browser do you use to open your AccessPoint ?

Do you have installed the extension on your QlikView webserver ?

On the server do you have an error or the extension is not loading at all ? (you can trace with modern browser like Chrome ou Firefox with Firebug)

Not applicable
Author

I've tried various browsers. All I need to do is copy the script.js file to the server. This worked for the old version with the bug.

Now the container with the 3d calculation remains empty. I've just tested with an alert('Hello') in the extension_Done function. This shows up.

I might still have something wrong in the script file.

I load firebug-lite with the script.js but I can't find anything wrong there.

Any ideas?

tlorimier
Partner - Contributor III
Partner - Contributor III

Do you copy all the folder or just the Script.js (i think your copying everything but just to be sure) ?

I just try to test your extension locally. The config panel is weird it's like this :

It should be like this if it was good :

I think the problem lie in your Definition.xml file. You should add an expression or a dimension or a text to see if it help (even if your not using it).

Not applicable
Author

Thibaut could you please zip your working solution so that I can compare it? I've tried several ways and still can't get it to run.

Thank you,

Thorsten

Not applicable
Author

I've tried several ways but I only get a blank window in the browser. Even an alert("Hello") doesn't work so it must be somewhere in the script.js - although everything works in the QV-Desktop App.

Can anyone help?

Not applicable
Author

I got it!

The slash before "lib" and after ThreeJS works in the Desktop App but not on the server:

var template_path = Qva.Remote + "?public=only&name=Extensions/ThreeJS/";

Qva.LoadScript(template_path + '/lib/js/three.min.js', function () {