Skip to Content
0

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

May 04, 2017 at 02:32 PM

40

avatar image

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

sdk
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Alfons Gonzalez Comas May 04, 2017 at 03:19 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Alfons Gonzalez Comas May 12, 2017 at 09:42 AM
0

Any idea about?

Share
10 |10000 characters needed characters left characters exceeded