cancel
Showing results for 
Search instead for 
Did you mean: 

SDK Component Issue: Trying to retrieve height with jquery when property height is set to auto

alfons_gonzalez
Active Participant
0 Kudos

Hi,
I am developing a Design Studio custom component and I am facing and annoying issue. The following first lines of component.js code is used to retrieve the height of the


////////////////////////////////////////////////////////////

this.init = function() {

outerWidth = this.$().width();

outerHeight = this.$().height();


The problem we face is that on several times the value of the height retrieved by the jquery statement is 0. Problems seems to appear when sthe property height of the component is set to auto. If the value is hardcoded the jquery statement works fine.
Anyon knows how to manage this issue?


Thanks,


Alfons

Accepted Solutions (0)

Answers (2)

Answers (2)

alfons_gonzalez
Active Participant
0 Kudos

Any idea about?

alfons_gonzalez
Active Participant
0 Kudos

Hi,

After additional testing we have found that problem appears if these 2 conditions (quite common are fulfilled)

- Component is in a Panel (if the component is directly on the Layout it does works)

- Layout Height Component Property is set to AUTO (if component layout height is set to a fixed value -e.g: 100- it does work fine even if component is in a layout)

It seems that by some reason the rendering of the Custom DS code is executed when the size of the panel is not completely calculated. This would explain why jquery does provide a 0.

Use of components in panels with an automatic size is a quite common scenario: how to be able to retrieve the final value of the layout in the component.js? Does it exist any way to obtain these values?

Thanks

Alfons