Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Brunch1
Contributor
Contributor

Paint function being called twice - cannot override resize method?

I am experiencing an issue where the paint method is being called twice. Upon looking at the forum it seems to be related to the resize method. I tried adding in the resize method just after the paint method in the file. I added a console log line and it isn’t being picked up. Please any advice?

Labels (4)
6 Replies
alex_colombo
Employee
Employee

Hi @Brunch1 could you please post your extension code?

Brunch1
Contributor
Contributor
Author

Hi @alex_colombo  I am just trying to call the resize method in a simple extension. 

 

define( [ 'jquery' ], function ( $ ) { 'use strict'; return {

resize: function ( $element, layout ) {

 console.log(‘test’)

},

paint: function ( $element, layout ) {

var $helloWorld = $( document.createElement( 'div' ) ); $helloWorld.html( 'Hello World from the extension "SimpleHelloWorld"<br/>' ); $element.append( $helloWorld ); } }; } );

 

but I cannot see the console log anywhere and still gets painted twice. The resize method does not get called and I am unsure why. 

alex_colombo
Employee
Employee

@Brunch1 resize is not a methoed allowed in extension APIs. What are you trying to achieve?
Could you please send me the entire code of your extension with all your files? I've tried to use your js code but it doesn't work for me with en error on console.log within resize method.

Brunch1
Contributor
Contributor
Author

@alex_colombo  from this link mentioned https://community.qlik.com/t5/New-to-Qlik-Sense/Qlik-Sense-Desktop-Extension-Paint-Function-called-t... - it mentions resize method that we can override? 

alex_colombo
Employee
Employee

@Brunch1 please try to use this code as a sample extension. Paint method is trigger once when app is loaded for the first time.

define( [ "qlik"
],
function ( qlik) {

	return {
		support : {
			snapshot: true,
			export: true,
			exportData : false
		},
		paint: function ($element) {
			//add your rendering code here
			$element.html( "Hello World" );
			console.log("paint")
			//needed for export
			return qlik.Promise.resolve();
		}
	};

} );

Brunch1
Contributor
Contributor
Author

@alex_colombo when I have the same extension on all the sheets and navigating to another sheet it paints it twice when I console log or when I refresh.