Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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

Tags (1)
6 Replies
Employee
Employee

Re: Qlik Sense Desktop, Extension Paint Function called twice

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

Mike

Regards,
Mike Tarallo
Qlik
erik_wetterberg
Honored Contributor

Re: Qlik Sense Desktop, Extension Paint Function called twice

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

}

Erik Wetterberg
https://extendingqlik.upper88.com/
MVP
MVP

Re: Qlik Sense Desktop, Extension Paint Function called twice

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

erik_wetterberg
Honored Contributor

Re: Qlik Sense Desktop, Extension Paint Function called twice

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.

Erik Wetterberg
https://extendingqlik.upper88.com/
MVP
MVP

Re: Qlik Sense Desktop, Extension Paint Function called twice

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

Highlighted
Luminary
Luminary

Re: Re: Qlik Sense Desktop, Extension Paint Function called twice

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.

Community Browser