Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9069

Re: How to bind result of oModel.callFunction - Get to Table?

$
0
0

Hi Alfonso,

 

I think in this case you should create a JSON model, add the data from the materiales to this JSON model and then bind the JSON model to your table. Your code would then look something like this:

 

var materialesModel = new sap.ui.model.json.JSONModel();

this.getView().setModel(materialesModel, "materiales");

 

oModel.callFunction("Materiales", // function import name

                                "GET", // http method

                               { ProductId : 'AA'  }, // function import parameters

                                null,

                            

                                function(oData, oResponse) {

                          

                              console.log(oResponse);

                              console.log(oData);

 

                              materialesModel.setData(oData.results);

 

                              alert("ok");

                                                           

                                }, // callback function for success

                                function(oError){

                                alert("err")

                                } ); // callback function for error

 

  oModel.refresh(true);

  oTable.bindRows("materiales>/");

 

  oTable.placeAt("content");

 

I always work with XML views so I'm not sure how you have to map the cells to the fields in javascript, but in XML the mapping to a field is like this: {materiales>Name}, so it's possible you'll have to change your javascript code to: template: new sap.ui.commons.TextField().bindProperty("value", "materiales>Name"), but that's something you have to test.


Viewing all articles
Browse latest Browse all 9069

Trending Articles



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