Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
is there any method to get the current selections of the app?
- Ralf
Yes,
You can retrieve it with the getList method see https://help.qlik.com/sense/en-us/developer/index.html#../Subsystems/Workbench/Content/BuildingWebsi... for more information
Yes,
You can retrieve it with the getList method see https://help.qlik.com/sense/en-us/developer/index.html#../Subsystems/Workbench/Content/BuildingWebsi... for more information
Is there another way to get the result during the paint function? It seems to be the callback is made asynchronously, receives result after end of paint..
Hi, I had the same question and i found a solution.
in the javascript file, you have to include "qlik" in define function, then you can call to app using this method:
var app = qlik.currApp();
code will be like this:
define(["jquery","qlik"], function($, qlik) {
return {
paint : function($element, layout) {
var app = qlik.currApp();
app.getList("CurrentSelections", function(data){
console.log(data);
});
}
}
That's exactly what I've coded but callback function is called after paint!
Yes, it is asynchronously, so, if it needs to paint something when the selected fields are ready, the logic to render HTML should be inside of callback function.
app.getList("CurrentSelections", function(data){
rendeView(); // for example
});
Understand, but why the paint function isn't called after the selected fields are ready? Would make more sense..
Essentially what you are doing is creating/accessing a separate object that gets its own change notifications. your extension will still fire a paint when the selection changes.
I used this to get the selected values during paint. You need to fetch all the entries in the field for it to work.
var selectedDates = qMatrix.filter(function(d) { return (d[0].qState == 'S') }).map(function(d) {
return d[0].qNum
});
Thanks, Karl. But this helps only for getting the selections inside of the defined cube. I don't understand why the API is lacking such basic function to obtain information about the current selections of the application.