Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 04, 2017 at 03:19 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • May 12, 2017 at 09:42 AM

    Any idea about?

    Add comment
    10|10000 characters needed characters exceeded