Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

y_grynechko
New Contributor II

Close hidden visualizations in Qlik Sense Mashup

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!

2 Solutions

Accepted Solutions
Highlighted
erik_wetterberg
Valued Contributor III

Re: Close hidden visualizations in Qlik Sense Mashup

Hi,

You need to save the object (viz in your example) you get back from the api. close() is a method on that object.

Erik Wetterberg
https://extendingqlik.upper88.com/
erik_wetterberg
Valued Contributor III

Re: Close hidden visualizations in Qlik Sense Mashup

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;

};

Erik Wetterberg
https://extendingqlik.upper88.com/
3 Replies
Highlighted
erik_wetterberg
Valued Contributor III

Re: Close hidden visualizations in Qlik Sense Mashup

Hi,

You need to save the object (viz in your example) you get back from the api. close() is a method on that object.

Erik Wetterberg
https://extendingqlik.upper88.com/
y_grynechko
New Contributor II

Re: Close hidden visualizations in Qlik Sense Mashup

I am really sorry but could you please give me some example?
Are we talking about saving under model and closing model later on?
erik_wetterberg
Valued Contributor III

Re: Close hidden visualizations in Qlik Sense Mashup

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;

};

Erik Wetterberg
https://extendingqlik.upper88.com/
Community Browser