Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Binding Control to JSON Model

Hi everyone. I'm trying to Bind a control to a JSON Model, but doesn't seem to be working:

// Model With Data

var lco_Model = new sap.ui.model.json.JSONModel(

{      Data: [ {      task : "done",

                         value : "10" },

      

                 {          task : "open",

                            value : "20" }      ]

});

  // Statistics Chart

  var lco_Dataset = new sap.viz.ui5.data.FlattenedDataset({

  // dimensions : [ {

  // axis : 1,

  // name : 'Task Status',

  // value : "{task}"

  // } ]

  measures : [ {

  name : 'Qty',

  value : '{value}'

  } ]

  });

  var lco_Dimension = new sap.viz.ui5.data.DimensionDefinition();

  lco_Dimension.setAxis(1);

  lco_Dimension.setName('Task Status');

  lco_Dimension.setValue(('{task}'});

  lco_Dataset.addDimension(lco_Dimension);

  lco_Dataset.bindData("/Data");

It works if I specify the value in the constructor (ie: un-commenting the lines).

Thanks in advance.

Former Member
replied

Jibran,


This statement - oMeasure.setValue("{value}"});

should be


oMeasure.bindProperty("value", "value");     // First value is the property that you want to bind, second value is your model value

Check the above statement and please let me know what was the output.


Regards,

Sai Vellanki.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question