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

Problem with getBindingContext() method

$
0
0

Hi All,

 

I need to fetch a column value from a table when a particular row has been clicked by the user.

 

I tried various things but nothing worked.

 

Please note that for this table binding, i made a separate request to fetch the data from a different model(other than the 1 set inside Component.js) & after fetching the results from the model.read method, i assigned the data into a JSON model using the setData method which is binded to the table inside the XML view.

 

I wrote the following code inside itemPressed method to do further processing:

 

oItem = oEvent.getSource();

oCtx = oItem.getBindingContext();

this._oRouter.navTo("ProdId",{ProdId: oCtx.getProperty("Prod_Id")});

 

But now the prob is that the result for getBindingContext() method above is shown as undefined by the system.

 

Although in the debug mode, if i check the object oItem, there is an object inside by the name oBindingContexts which is having all the details & i am even able to fetch the respective attribute value. But as per my understanding, we should only access the properties of any object using the GET & SET methods as recommended by SAP as well. But again, the usual GET method is not working in my case.

 

Could you please let me know:

1) Why the normal getBindingContext method is not working in my case?

2) How to make the above work or a recommended alternative as per good coding practices?

 

TIA. A quick response would be highly appreciated.

 

Regards,

Sumit Jindal


Viewing all articles
Browse latest Browse all 2106

Latest Images

Trending Articles



Latest Images