Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

ikomlyakov1929
New Contributor III

Mashup: qlik.resize(ID) don't work when ID specified

I have a mashup where a few elements hide and show depending on the amount of data received from the qlik. So I have faced the problem that on showing hiden elements, they does not appear. I decide to solve this problem by dispatching RESIZE event on show, but I need to send this event only for specific elements.

According to this source qlik.resize(ID) could do this, but whether i specify ID or not, the event is called on all elements.

How I Use it:

app.getObject('QV02','FpUgm');

qlik.resize("FpUgm");

Does anyone know why this is not working?

2 Replies
Employee
Employee

Re: Mashup: qlik.resize(ID) don't work when ID specified

Hi ikomlyakov1929‌,

getObject method returns a Promise, you may need to wait for the visualization to load first

app.getObject('QV02','FpUgm').then(function(viz){

     qlik.resize('FpUgm');

});


But your issue seems more complex. You should call qlik.resize in the "show" callback.

I hope this helps,

ikomlyakov1929
New Contributor III

Re: Mashup: qlik.resize(ID) don't work when ID specified

Thank you for your answer, aaz‌‌!

Actually, my code looks like this:

app.getObject('QV01','jte');

app.getObject('QV02','FpUgm');

app.getObject('QV03','PGWJPKD');

app.getObject('QV04','dEGPWY');

app.getObject('QV05','fxPbkkt');

app.getObject('QV06','QSMmMX');

app.getObject('QV08','FpUgm');

app.getObject('QV09','PGWJPKD');

app.getObject('QV10','dEGPWY');

app.getObject('QV11','fxPbkkt');

app.getObject('QV07','mGaAetB');

app.getObject('QV12','ZPLgw');

app.getObject('QV13', 'KLqRY');

//working with selections

var selState = app.selectionState( );

var currentState = 'noSelected';


var listener = function() {

var senArr = $.grep(selState.selections, function(a) { return a.fieldName === 'SName'});

if (senArr.length === 0) {

$('.multiSelected').hide();

$('.oneSelected').hide();

$('.noSelected').show();

} else if (senArr.length === 1 && senArr[0].selectedCount === 1) {

$('.noSelected').hide();

$('.multiSelected').hide();

$('.oneSelected').show();

} else {

$('.oneSelected').hide();

$('.noSelected').hide();

$('.multiSelected').show();

}

};

selState.OnData.bind( listener );

So I have tried to insert the following code in every if else:

app.visualization.get('FpUgm').then(function(vis) {

    qlik.resize('FpUgm');

});

but unfortunately, I got the same result - resize event occurs on every element. Luckily, I found kind of proper solution, just replace previous code wiith the follow code

app.visualization.get('FpUgm').then(function(vis) {

    vis.show('QV08');

});



Community Browser