Skip to main content

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Mich90GSG_o
Contributor
Contributor

gotoSheet() in div

Hi,

in my extension I am trying to call gotoSheet() in a div.

My javascript

 

var link = document.createElement("div");
link.setAttribute("ng-click", "navigation.gotoSheet('" + linkitem.sheetid + "');");
var span = document.createElement("span");
span.setAttribute("class", "lui-icon lui-icon--play");
span.setAttribute("area-hidden", "true");
link.append(span);
var span1 = document.createElement("span");
span1.innerHTML = "Test";
link.append(span1);

 

This leads into:

 

<div ng-click="navigation.gotoSheet('9076ed39-9650-4d60-9298-0e466fd9bb5c');">
<span class="lui-icon lui-icon--play" area-hidden="true"></span>
<span>Test</span>
</div>

 

It doesn't do anything when clicking on that div.

Someone has an idea?

PS: I tried without the ' but it didn't work as well...

Thanks!

1 Solution

Accepted Solutions
devan9876
Creator
Creator

Maybe you need to prefix it with qlik so "qlik.navigation.gotoSheet(..."


The one time I did this I never used the ng-click event tho. I did it with vanilla js event listener and stored the sheet id as a data-attribute on the element.
So maybe something like:

link.setAttribute('data-sheet','YourSheetIdHere');

link.addEventListener('click',function(){
    qlik.navigation.gotoSheet(this.getAttribute('data-sheet'));
});

 

 

View solution in original post

2 Replies
devan9876
Creator
Creator

Maybe you need to prefix it with qlik so "qlik.navigation.gotoSheet(..."


The one time I did this I never used the ng-click event tho. I did it with vanilla js event listener and stored the sheet id as a data-attribute on the element.
So maybe something like:

link.setAttribute('data-sheet','YourSheetIdHere');

link.addEventListener('click',function(){
    qlik.navigation.gotoSheet(this.getAttribute('data-sheet'));
});

 

 

Mich90GSG_o
Contributor
Contributor
Author

Man, this is perfect and works instantly!!!! 

The first qlik.navigation does not work (I don't know why) - but your second hint works fine!

 

Thanks you so much!