Skip to Content
avatar image
Former Member

passing value from the model in UI element

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 20, 2017 at 03:40 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 20, 2017 at 01:46 PM

    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

    Add comment
    10|10000 characters needed characters exceeded