on 11-02-2015 6:49 AM
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.
Hi Jibran,
Is there any reason, why you're not creating the measure same like dimension definition using method .addMeasure() of flattenedDataset, try like this and check -
var oDataset = new sap.viz.ui5.data.FlattenedDataset();
var oMeasure = new sap.viz.ui5.data.MeasureDefinition({name:"Qty", value:"{value}"});
oDataset.addMeasure(oMeasure);
Check the sample here: Plunker - VizFrame, I have commented the Constructor code and use chain of methods in the controller.
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes the constructor method works without any problems. But how would I bind the value at a later stage? In the output I see whatever text resides between the two brackets '{' '}', but not the bound value. If I mention, "{value}", the actual string "{value}" reappears in the output, and not the value that is residing in JSON field value.
Property binding is available for all the controls which has properties.
Check this link for property binding syntax: Property Binding - User Interface Add-On for SAP NetWeaver - SAP Library
Regards,
Sai Vellanki.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.