Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
y_grynechko
Creator III
Creator III

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
ErikWetterberg
Master
Master

Hi,

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

View solution in original post

ErikWetterberg
Master
Master

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;

};

View solution in original post

3 Replies
ErikWetterberg
Master
Master

Hi,

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

y_grynechko
Creator III
Creator III
Author

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

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;

};