cancel
Showing results for 
Search instead for 
Did you mean: 

How to read UI control width interms of pixels

Former Member
0 Kudos

Hi,

I defined a panel with Width as 100% from xml view but from controller , I want to read actual width interms of pixel size to use same pixel width for another control to set its width to clear whitespace.

when I tried to use getWidth() simply, it is giving as 100% . Is there any way to get size in pixels,please share recommendations.

Regards,

Koti Reddy

Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor
0 Kudos

Hi Koti

Here is an example

Sample

-D

Answers (2)

Answers (2)

santhu_gowdaz
Active Contributor
0 Kudos
0 Kudos

Hi Koti,

Please use jquery function to get the width value in pixel (Highlighted in bold)

var button = new sap.m.Button({

      icon: 'sap-icon://accept',

      press: function() {

       

          alert($('#myPanel').width());

      }

    })

var p = new sap.m.Panel("myPanel",{

  width : '100%',

  content: [

        button

  ]

});

0 Kudos

Dennis is also using jQuery way of getting width in pixel. Thanks.