Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ikomlyakov1929
Partner - Contributor III
Partner - 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
Aiham_Azmeh
Employee
Employee

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
Partner - Contributor III
Partner - Contributor III
Author

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');

});