Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have an issue with Qlik Sense Desktop Extensions. The Paint Function is called twice each time. Any advice to prevent this?
- Ralf
Hi Ralf - I am getting someone to help with this, please stand by.
Mike
Hi Ralf,
As a rule your extension should handle multiple calls to paint. That said there is one thing you could do. An extension has a default implementation of the resize method that calls paint (which in many cases is a good thing to do). You could add your own implementation of resize and do something else:
resize: function($element,layout){
//handle resize
}
Hi Erik,
thanks for this useful hint. I will try to solve it if I can compare old and new size if possible to skip the second paint.
However, I wonder why paint is called twice the first time the extension is rendered (no resize user interaction).
- Ralf
Well another reply is that we are continuosly developing the product. When I check this in a later (development) version I can see that the paint method is no longer called twice on startup. I can not guarantee that this will be the case in the next released version, we might discover problems, and we would rather call the paint method an extra time than missing a call (which would mean that the wrong data is displayed).
So the advice is still your extension should not break if it is called even when there are no changes. We can not guarantee that there will be no extra calls.
Of course it should not break. It just takes double time to process the data and render..
If I do the following:
paint : function($element, layout) { alert('paint 1'); $element.html('hello word') ; alert('paint 2');
Then I get 4 messages, all of them before anything is displayed.