cancel
Showing results for 
Search instead for 
Did you mean: 

Binding a value to numeric content of a tile

former_member213535
Participant
0 Kudos

Hi,

I have created a generic tile with numeric content. Now for the value property i should get value from OData model..

i wrote the following code..but it is displaying value as '0'..

var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZAVGS_SRV_01/", true);

    this.getView().setModel(oModel);

    var ocore = sap.ui.getCore();

    var t11 = ocore.byId("avg");

  

    t11.bindProperty("value","/LtAvgsSet/avg");

Here, I want to get value of field avg from table..and set that to numeric content of tile..

Can anybody help ??

Accepted Solutions (1)

Accepted Solutions (1)

former_member213535
Participant
0 Kudos

I solved it using bindElement method..

bulls.bindProperty("value", "SchImp");

         bulls.bindElement("/LtAvgsSet/0");

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

does /sap/opu/odata/sap/ZAVGS_SRV_01/LtAvgsSet have a right value in avg when you call it?

former_member213535
Participant
0 Kudos

Hii,

Yes, it has the value..

I tried binding from the view also..but the value is displayed as 0

var bulls =  new sap.suite.ui.commons.NumericContent("impactsavg",{

                 size : sap.suite.ui.commons.InfoTileSize.Auto, 

                 value : "{SchImp}",

                 scale : " ",

                 valueColor : sap.suite.ui.commons.InfoTileValueColor.Good,

               });

              bulls.setModel(oModel);

Former Member
0 Kudos

Hi,

You should convert the string to Integer using ParseInt and then bind. I too faced this issue .

former_member213535
Participant
0 Kudos

Hi Koti,

The value attribute of numeric content is string type..then why to convert to integer ??

Former Member
0 Kudos

Hi,

Are you sure it is of string type?

first Try with hard code and check what kind of values it is accepting. I used ComparisonData for which I got issues to display with String values.

I suspect it will be of same error in your case as well.

From debugging , try to set values and check.

Regards,

Koti Reddy

former_member213535
Participant
0 Kudos

Hard coded values are working fine. I think the problem is with binding..can you please check my code once..

former_member182372
Active Contributor
0 Kudos

do you see request in Dev tools -> Network after you bind the property, post response content from there

former_member213535
Participant
0 Kudos

Hi Maksim,

Could you please elaborate..??

former_member182372
Active Contributor
0 Kudos
former_member213535
Participant
0 Kudos

There are no requests under Network