Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Is it possible to resize an extension object within itself? For example, if after some action there are more rows to be shown, the height could increase.
Something like this:
if(variable1 > variable2){
extObject.width = extObject.width + 100;
}
Our goal is to create a new kind of object for making selections by creating an extension object. One of the requirements would be to be able to control the size of the extension object depending on the selections. I have been going through examples and reading the forum posts but nothing of this sort has caught my eye yet, and I'm afraid that would mean that there is no way control the size of the object.
Best regards,
Henry Backman
Yes, an extension object is essentially just another div on a webpage (which is a QlikView sheet in this case) so you can definitely change it.
You could do this a variety of ways, but my suggestion would be to create a div (or table or whatever you're doing) inside the extension that holds all the rows. Then add all the data and even though the extension div itself has a set height, the table you created inside will have its own height. Now, just get the height of the table or div you created and set the extension's div to this same height.
So, say you've created a table with an id of "superTable". Once all the rows have been added to superTable AND you've added that table and its HTML to the extension, get the height of this table into a variable:
var tableHeight = document.getElementById("superTable").offsetHeight;
Then set the height of the extension itself to this height:
this.Element.style.height = tableHeight + "px";
Make sense?
I'm no expert at this, probably Brian will have a better idea, but I believe you could just resize the containing DIV using Jquery or just regular javascript.
Hmm, I did see posts talking about changing the sizes of objects with javascript. Would it then work so that I write the resizing script as part of the document script module and then call that from my extension object? Or some other way?
I'll anyways try that next, thank you!
Yes, I see no difference about running that script from within a document or an object extension.
Yes, an extension object is essentially just another div on a webpage (which is a QlikView sheet in this case) so you can definitely change it.
You could do this a variety of ways, but my suggestion would be to create a div (or table or whatever you're doing) inside the extension that holds all the rows. Then add all the data and even though the extension div itself has a set height, the table you created inside will have its own height. Now, just get the height of the table or div you created and set the extension's div to this same height.
So, say you've created a table with an id of "superTable". Once all the rows have been added to superTable AND you've added that table and its HTML to the extension, get the height of this table into a variable:
var tableHeight = document.getElementById("superTable").offsetHeight;
Then set the height of the extension itself to this height:
this.Element.style.height = tableHeight + "px";
Make sense?
Sorry it took me a while to answer, got busy with other things. I did a quick test and yes, that's how it should be done and it works. Thank you very much!