Qlik Community

Ask a Question

QlikView Integrations

Discussion Board for collaboration on QlikView Integration.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Include external stylesheet?

Hi,

How can I include an external stylesheet? I've tried:

loadcss = document.createElement('link');

loadcss.setAttribute("rel", "stylesheet");

loadcss.setAttribute("type", "text/css");

loadcss.setAttribute("href", "style.css");

document.getElementsByTagName("head")[0].appendChild(loadcss);

..inside LoadScript->AddExtension() { } but without success, any ideas?

best regards.

1 Solution

Accepted Solutions
Not applicable
Author

Hi gabrielh,

Qva.LoadScript and Qva.LoadCSS are not documented in the current version of the AJAX API reference in the QlikView SDK.

As of QlikView 10 SR3 they will be included in a vastly improved AJAX API reference.

As an example you would call Qva.LoadScript would be called like:

Qva.LoadScript("/QvAjaxZfc/QvsViewClient.aspx?public=only&name=Extensions/FC_Ext_Example/FusionCharts.js", FC_Ext_Example_Done);

This takes two parameters the first is the URL to the file you want and the second is the function to call after your  script has been loaded (i.e. the function that calls your Qva.AddExtension).

The URL is the path to your QvsViewClient.aspx with two URL parameters public=only and the relative path to the whatever file you bundled in your extension that you want to load. E.g. name=Extensions/extension_name/your_file.ext.

The tricky part is that (at least in the current version) you have to use the path as described above EVEN if your real path is more like "Extensions/Objects/extension_name/your_file.ext (i.e. even if your extension is in the Objects sub directory, you don't include it in the path.

Also you should note that you can also use this path when ever you want to refer to any bundled file. See my fusion charts example in the thread http://community.qlik.com/thread/29376?tstart=0 that shows using this syntax as a parameter to the Fusion Chart function that needs the path to the .swf file.

Regards,

Dan

View solution in original post

10 Replies
Not applicable
Author

To reference static files located in your extension folder, you have to use this kind of url:

/QvAjaxZfc/QvsViewClient.aspx?public=only&name=Extensions/YourExtensionName/yourfile.ext

Note there is also a LoadCSS function available in the Qva namespace, so you can load your css like this:

Qva.LoadCSS('

/QvAjaxZfc/QvsViewClient.aspx?public=only&name=Extensions/YourExtensionName/style.css

');

Not applicable
Author

That looks promising. Could you explain the different parts of the url?

Where can I find those different functions available in the Qva namespace?

Not applicable
Author

Unfortunately I can't, I got this information without explanations from QlikTech while version 10 was in beta.

Not applicable
Author

Hi gabrielh,

Qva.LoadScript and Qva.LoadCSS are not documented in the current version of the AJAX API reference in the QlikView SDK.

As of QlikView 10 SR3 they will be included in a vastly improved AJAX API reference.

As an example you would call Qva.LoadScript would be called like:

Qva.LoadScript("/QvAjaxZfc/QvsViewClient.aspx?public=only&name=Extensions/FC_Ext_Example/FusionCharts.js", FC_Ext_Example_Done);

This takes two parameters the first is the URL to the file you want and the second is the function to call after your  script has been loaded (i.e. the function that calls your Qva.AddExtension).

The URL is the path to your QvsViewClient.aspx with two URL parameters public=only and the relative path to the whatever file you bundled in your extension that you want to load. E.g. name=Extensions/extension_name/your_file.ext.

The tricky part is that (at least in the current version) you have to use the path as described above EVEN if your real path is more like "Extensions/Objects/extension_name/your_file.ext (i.e. even if your extension is in the Objects sub directory, you don't include it in the path.

Also you should note that you can also use this path when ever you want to refer to any bundled file. See my fusion charts example in the thread http://community.qlik.com/thread/29376?tstart=0 that shows using this syntax as a parameter to the Fusion Chart function that needs the path to the .swf file.

Regards,

Dan

View solution in original post

Not applicable
Author

Hi deh,

You said the ajax api will be "vastly improved" in SR3, could you give me more details about that? Is a release date already set?

Not applicable
Author

Thanks to both of you!

Not applicable
Author

Hi jgeorge,

The improved API reference will include better descriptions of methods and members and actual example code for almost every method in the API. We will also have it in QVW format so you can search and filter better.

QlikView 10 SR3 is scheduled for late June / early July.

Regards,

Dan

Not applicable
Author

Qva.LoadScript() for loading javasscripts

Qva.LoadCSS() for loading stylesheets

When I'm developing my extension im using quite alot of HTML to display/arrange my elements. At the moment I've uploaded the HTML-part on my server and using crossbrowser javascript to fetch the HTML-content from there and then simple assigning it to innerHTML. That way I dont need to use javascript to add it the script-way such as:

var content = "<div.........."+

                         ".............."+

                     ".......</div>";

or

var content = "<div.........";

content += "..........";

content += "..........</div>";

Which impairs the visual representation of the code.

In my HTML-file i can write it as it's supposed to:

<div ........>

     .........

</div>

My question, is there an equivalent like Qva.LoadHTML() to load an .html-file and adding the content.

If not, what's the best practice for HTML-code?

Not applicable
Author

Hi galbrielh,

I have to confess I do not know. I'm inclined to say that QlikView gives you the ability to fire custom JavaScript. From there how you store and append any of your custom HTML is a pure JavaScript best practice rather than a QlikView best practice.

I know that's not the exact answer you are looking for, but I would say that is where we are today.

Regards,

Dan