Skip to Content
0
Nov 02, 2015 at 06:49 AM

Binding Control to JSON Model

20 Views

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.