Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I am looking for more documentation for the visualization API. Especially for these 2:
Only the get method includes an example:
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.visualization.get('xGhjKl').then(function(vis){
vis.show("QV01");
});
I can follow along so far, but when I want to close an object I don't understand what to do.
I have found this thread that discusses these methods:
Some quotes from that thread:
viz = app.visualization.get('xGhjKl');
...
viz.close()
How would I implement this if I don't have a 'QV01' somewhere? How would my HTML know where to put this visualization? I also don't really understand how the link works if there is a 'QV01' present or how the show() solves this? Is there any simple information about this and how it works?
I recommend you use it exclusively over app.getObject.
With 'it' fka means the The Visualization API. He also mentions the walker dashboard as an example, but that basically uses the same code as the example given in the documentation of the get method.
So my problem is, I would love to use the visualization API, but I can't find any examples with anything else than a simple show that works for me. I tried using everything from that thread but I either completely closed all my objects or it did nothing.
So I am looking for examples that can help me learn the visualization API or something that shows me how I can show() / close() a qlik sense object with for example a button?
(I am a big noob, so I might have said something super dumb. Please point it out if that's the case, because I would like to learn how this all works).
Any help is appreciated,
Casper
Some quotes from that thread:
viz = app.visualization.get('xGhjKl');
...
viz.close()
How would I implement this if I don't have a 'QV01' somewhere? How would my HTML know where to put this visualization? I also don't really understand how the link works if there is a 'QV01' present or how the show() solves this? Is there any simple information about this and how it works?
Unlike getObject method, this get method return a promise of QVisualization object which in this case is saved to variable viz. This object is yet to be placed in the HTML. To place it in your HTML you need to call show method of the QVisualization object.
So my problem is, I would love to use the visualization API, but I can't find any examples with anything else than a simple show that works for me. I tried using everything from that thread but I either completely closed all my objects or it did nothing.
So I am looking for examples that can help me learn the visualization API or something that shows me how I can show() / close() a qlik sense object with for example a button?
Below is an example where we first load a visualization then create a button to close it. Notice that since viz is not really the QVisualization, show and close are not methods of viz.
function close01(){
viz.then(result => {
result.close();
});
}
var app = qlik.openApp('Consumer Sales.qvf', config);
let viz = app.visualization.get('fNGRa');
viz.then(result => {
result.show('QV01');
});
$('#bu-01').click(close01);
Sorry, that's the wrong API.
Erik Wetterberg
Thanks a lot! I tried after reading your explanation / example and now it works!
I am going to play around with it some more and will share my results so others have some more examples to play around with.
One thing I was wondering though, how would the .js look with lots of objects? Because even ignoring the close function you still have way more lines of code for just one object.
Thanks again, really helped!