sapui5

How can I get actual height of application after rendering?


How can I get the actual size of a view in SAPUI5 applications?

I tried:

this.getView().getHeight();

but it returns nothing. Also

this.getView().getWidth();

returns 100% thus these 2 methods do not return the actual sizes.


Solution

  • getHeight and getWidth will return the property value, width of a view is set to 100% by default and height has no default hence the return values you are getting.

    if you want the CSS dimensions you can try this...

    this.getView().$().height()
    

    and

    this.getView().$().width()
    

    you could also use alternate jQuery methods which will account for padding, border and margin - see here for further explanation