10 Replies Latest reply: Jun 16, 2011 8:05 AM by gabrielh RSS

    Include external stylesheet?



      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");



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


      best regards.

        • Include external stylesheet?

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



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




          • Include external stylesheet?
            Dan English

            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.





              • Include external stylesheet?

                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?

                  • Include external stylesheet?

                    Thanks to both of you!

                    • Include external stylesheet?
                      Dan English

                      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.





                        • Include external stylesheet?

                          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.........."+





                          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 ........>




                          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?

                            • Include external stylesheet?
                              Dan English

                              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.