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

Re: Data binding issue with JSON Model

$
0
0

Hi Venkatesh,


Yes as per you suggestion if I change the JSON constructor line, it works. Thanks.


But it creates one more problem. Let me explain what I am trying to do.


I have OData service with following entityset structure:


Deals                      -> Master

  Systems              -> Detail

  Documents          -> Detail

  References          -> Detail


On Master view, I am displaying list of Deals. And when user selects any particular Deal from master view, it should show Systems, Documents and References list on details view.


I want all the data should be fetched in single call to server so I am using $expand parameter. Following code I have written for List select event handler


handleListSelect : function (evt) {
  
  var context = evt.getParameter("listItem").getBindingContext();
   
  var oModel = this.getView().getModel();
 
  var newContext = null;

 

oModel.read(context.getPath(), null, {"$expand":"SystemCollection,DocumentCollection,ReferenceCollection"}, false, function(oData, oResponse){ 
 
  var model = new sap.ui.model.json.JSONModel(oData);
  newContext = new sap.ui.model.Context(model, context.getPath());

    });
     
  this.nav.to("Detail", newContext);
 
},


1. Now context.getPath()); returning index of selected Deal ( DealCollection/0 ) earlier when I was binding with ODataModel it was returning key of selected Deal ( /DealCollection('100100100123') ).


2. Can you please suggest me what should be the correct code for above highlighted code in red color?

 

I believe its very common scenario, what is the best approach ? If I use ODataModel directly, it always make individual server calls.

 

Regards,

Vikram


Viewing all articles
Browse latest Browse all 9236

Trending Articles



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