Skip to Content
0

How to get all the properties of a control and all the parameters of this property

Aug 16, 2017 at 09:30 AM

73

avatar image

Hi UI5 experts

I'm new to UI5 even JS. Currently facing some probems during UI5 learning.

Two questions below.

1. How to get all properties of a control?

2. How to get all parameters of a property?

I know there is UI5 API reference, but just losted in the API document. Here is my example.

oText =new sap.m.Text({
   value: {
      path: "/Suppliers/0/Name",
      formatter: function(sValue){
         return sValue&&sValue.toUpperCase();
      }
   }
});

I checked the properties of sap.m.Text control, there is no "value" property.

And also the parent control of sap.m.Text which is sap.ui.base.ManagedObject and sap.ui.core.Control, I can't find "value" propety also in there.

Could you help to guide me on this?

Thanks!

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

4 Answers

Best Answer
Srikanth KV Aug 16, 2017 at 04:20 PM
0

All controls have metadata, this provides properties and method names

eg: Consider a Button control....then access metadata for the same using below code

var oButton = new sap.m.Button();
oButton.getMetadata();

UI5 API reference is good when compared to UI5 source code documentation

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Srikanth

Thanks for your reply!

0
Emanuele Ricci Aug 16, 2017 at 01:48 PM
0

Hi Webnit,

there's no better way to understand how something works to read it's documentation or looking at source code.

OpenUI5 is opensource so you can directly take a look at it's source code. Documentation you have already linked comes from source code.

Text has not a value property because it's not enlisted in it's properties and because Control (the class it's extending) has not that property too.

Value is a typical property of an Input control.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Emanuele

Thansk for your reply!

OpenUI5 is really a good place to find everything "original" by the source code reading.

0
Jerry Wang
Mar 05 at 09:24 AM
0

Hi Wenbin,

there is a small tip to get all what you want in Chrome development tool by debugging, check my article in 知乎.

Best regards,

Jerry

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Jerry

Nice to see you here and thanks for the guidence.

Subscribed your Wechat official account last year, nice place to learn and follow SAP's tech trends.

0
Emanuele Ricci Mar 05 at 12:03 PM
0

Hi Wenbin Yin,

in my opinion, the best way to know which properties, events and aggregation are supported by a specific Control is to check directly the source code of OpenUI5: https://github.com/SAP/openui5

This allow you to also understand which are the best practice to code.

Otherwise you can always checkout the API documentation: https://openui5.hana.ondemand.com/#/api

Share
10 |10000 characters needed characters left characters exceeded