Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rbecher
MVP
MVP

Qlik Sense Desktop, Extension Paint Function called twice

Hi,

I have an issue with Qlik Sense Desktop Extensions. The Paint Function is called twice each time. Any advice to prevent this?

- Ralf

Astrato.io Head of R&D
6 Replies
Michael_Tarallo
Employee
Employee

Hi Ralf - I am getting someone to help with this, please stand by.

Mike

Regards,
Mike Tarallo
Qlik
ErikWetterberg

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

}

rbecher
MVP
MVP
Author

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

Astrato.io Head of R&D
ErikWetterberg

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.

rbecher
MVP
MVP
Author

Of course it should not break. It just takes double time to process the data and render..

Astrato.io Head of R&D
tseebach
Luminary Alumni
Luminary Alumni

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.