Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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");

}