Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
Hi @Brunch1 could you please post your extension code?
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.
@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.
@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?
@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();
}
};
} );
@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.