Skip to Content
0

passing value from the model in UI element

Nov 20, 2017 at 01:40 PM

35

avatar image
Former Member

Hi Experts

I need to pass value from the model to the press event of the Link ui element.

I tried this but it didnt work

<Link press="onOpenAttachmentDlg({requestModel>vendorId})" >

Could you please let me know how i can pass the value from the model in view so that i can get it in the controller.

Thanks

Karthi D

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Irfan Gokak Nov 20, 2017 at 03:40 PM
0

Hi,

You need to get current rows binding object. You can do it as below.

<Link press="onOpenAttachmentDlg" >

// In controller 
onOpenAttachmentDlg:function(oEvent){
  var oData = oEvent.getSource().getBindingContext(“<modelname>”).getObject();

// In oData object you’ll get VendorId from current row. Check in debugger 
}

If this helps you please mark as answered.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 20, 2017 at 01:46 PM
0

Hi Experts

This ui element is in a table column

So i cannot use id for this element to get the value using sap.ui.getCore().byId("id").

Thanks

Karthi D

Share
10 |10000 characters needed characters left characters exceeded