Skip to Content

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

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Aug 16, 2017 at 04:20 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 16, 2017 at 01:48 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 05 at 09:24 AM

    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

    Add comment
    10|10000 characters needed 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.

  • Mar 05 at 12:03 PM

    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

    Add comment
    10|10000 characters needed characters exceeded