Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Split Javascript function

Hi,

I would like to split my javascript extension into function.

Currently I have my extension defined like this:

Qva.LoadScript(template_path + 'tinydropdown.js', function () {

    Qva.AddDocumentExtension('dropdownMenu', function(){

  Qva.LoadCSS(template_path + "tinydropdown.css");

  var _this = this;

  var mydoc = Qv.GetCurrentDocument();

  _this.Document.SetTabrowPaint(paintNav);

  var tabrowDiv = document.getElementById("Tabrow");

  tabrowDiv.removeAttribute("class");

  });

});

I would like to externalize these lines into a function:

  _this.Document.SetTabrowPaint(paintNav);

  var tabrowDiv = document.getElementById("Tabrow");

  tabrowDiv.removeAttribute("class");


I have tried but it is not working.


Could you please help me?

Thanks

2 Replies
adamdavi3s
Master
Master

Hi Alexandre,

Can you share what you did to try and do this?

It should work fine as long as you're calling it etc

Anonymous
Not applicable
Author

Hi,

I have tried to split te function like this:

Qva.LoadScript(template_path + 'tinydropdown.js', function () {

    Qva.AddDocumentExtension('dropdownMenu', function(){

  //Load a CSS style sheet

  Qva.LoadCSS(template_path + "tinydropdown.css");

chargemenu();

});

});

function chargemenu()

{

  var _this = this;

  var mydoc = Qv.GetCurrentDocument();

  _this.Document.SetTabrowPaint(paintNav);

  // overrule the standard QlikView tabrow style

  var tabrowDiv = document.getElementById("Tabrow");

  tabrowDiv.removeAttribute("class");

}