Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
(Edited to add code and images.)
In my extension's paint() method, I am accessing the selectionState().selections array. All seems to work fine generally, but when I do a reload of the webpage, the selections array is empty when paint() is called. A subsequent interaction that causes paint() to be called again finds the selections array populated.
Have I got some sort of race condition where the app has yet to load/cache the current selections?
Here is some sample code:
define(["qlik","css!./styles.css"], function (qlik) {
return {
support : {
snapshot: false,
export: false,
exportData : false
},
paint: function ($element) {
console.log(qlik.currApp().selectionState());
console.log(qlik.currApp().selectionState().selections);
return qlik.Promise.resolve();
}
};
} );
And here are images demonstrating my issue:
1. I currently have three Fields (4 Field Values) selected.
2. When I reload my JS console shows the following. Note the highlighted parts.
3. When I then open those interactively in the console, they are populated.
Thus, at the time paint() is called, my extension does not have the correct information about what is selected.
hello,
can you please provide demo of your code?
Regards,
Harsh Gohil
I think I figured it out.
The selections may not yet be loaded, so I should bind a listener to
qlik.currApp().selectionState().OnData
I would suggest the documentation be updated to indicate a few things: