Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8392

Model and binding issue

$
0
0

hello,

 

I have two views , a main view with a textbox and a button and a view that i want to use as a quick view that will show a pie chart for the textbox in the first view... , I used a global model as a model for the PIE and im changing the model data from the first view when user clicks the button..

 

pictures of the results:

 

111111.JPG

and after I hover with the mouse on the textbox:

22222.JPG

 

 

 

 

the code of the main view:

 




createContent : function(oController) {


var oModel = new sap.ui.model.json.JSONModel({array:[

                                                     {status:"occ",seats:50},                                                     {status:"free",seats:50}

]});



sap.ui.getCore().setModel(oModel, "model");



var pieView = sap.ui.view({viewName:"pietest.pie", type:sap.ui.core.mvc.ViewType.JS});

var rfl = new sap.ui.layout.ResponsiveFlowLayout();

rfl.addContent(pieView);



var oQuickView = new sap.ui.ux3.QuickView( "QuickView1", {

width:"auto",
            type:"Account",



firstTitle:  "fxhf",

content:rfl,

showActionBar:false



})



var oInput1 = new sap.ui.commons.TextField("blat");

oInput1.setTooltip(oQuickView);


var matrix =  new sap.ui.commons.layout.MatrixLayout();

matrix.createRow(oInput1);

matrix.createRow(new sap.ui.commons.Button({text:"press",press:function(){


var omod = sap.ui.getCore().getModel("model");

omod.oData.array[1].seats = 3;

omod.refresh();



}}));



return matrix;



}


 

 

the code of the Pie view:

 

createContent : function(oController) {  var omod = sap.ui.getCore().getModel("model");    // A Dataset defines how the model data is mapped to the chart  var oDataset = new sap.viz.ui5.data.FlattenedDataset({  // a Bar Chart requires exactly one dimension (x-axis)  dimensions : [  {  axis : 1, // must be one for the x-axis, 2 for y-axis  name : 'status',  value : "{status}"  }  ],  // it can show multiple measures, each results in a new set of bars in a new color  measures : [     // measure 1  {  name : 'seats', // 'name' is used as label in the Legend  value : '{seats}' // 'value' defines the binding for the displayed value  },  ],  // 'data' is used to bind the whole data collection that is to be displayed in the chart  data : {  path : "/array"  }  });     // create a Pie  var oPie;  oPie = new sap.viz.ui5.Pie({  width : "400px",  height : "480px",  title : {  visible : true,  text : 'LOL'  },  dataset : oDataset  });  oPie.setModel(omod);  return oPie;  }

 

 

it doesn't refresh the data of the pie...  after I click the button the pie stays 50:50 as it was before I clicked. any help please??


Viewing all articles
Browse latest Browse all 8392

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>