Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.
Hello,
I am having issue with closing visualizations in the Mashup. It is the one page mashup- converted from multi-page mashup to preserve selection between pages.
At first I used this approach:
app.getObject('MashupID','QlikID').then(function(model){modelRef = model;});
and tried to close the model later on:
function destroyQlikObjects(flag1) {
if(flag1 == 1) {
modelRef.close();
}};
It didn't work, so after spending some time here I found out that better way is to get visualization not object because visualization API has close method. I am trying to use it:
app.visualization.get('QlikID').then(function(viz){
viz.show("MashupID");
app.visualization.close('QlikID');
but in the browser I get this error:
Uncaught TypeError: app.visualization.close is not a function
Can someone please help me understand it?
Thank you!
Solved! Go to Solution.
Hi,
You need to save the object (viz in your example) you get back from the api. close() is a method on that object.
Something like:
var vizObject;
//when you dispaly the chart:
app.visualization.get('QlikID').then(function(viz){
vizObject= viz;
vizObject.show("MashupID");
});
//and when you want to close it:
if(vizObject){
vizObject.close();
vizObject = undefined;
};
Hi,
You need to save the object (viz in your example) you get back from the api. close() is a method on that object.
Something like:
var vizObject;
//when you dispaly the chart:
app.visualization.get('QlikID').then(function(viz){
vizObject= viz;
vizObject.show("MashupID");
});
//and when you want to close it:
if(vizObject){
vizObject.close();
vizObject = undefined;
};