Skip to Content

How to pass dynamic data to sapui5

Hi All,

I have few doubts in using SAP.M.LINK.

Through my oData, I am passing multiple links/URLs to my front end. These links will be available under "Attachments" label.

I am getting the value of my 1st link as -

var Link1 = sItem.getBindingContext().getProperty("Link1");

and similary...

var Link2 = sItem.getBindingContext().getProperty("Link2"); and other links.

I tried using the below syntax, but it does not navigate to my URL(even when Link1 has correct value). When I hard coded, a URL in my HREF property, it got successfully navigated to that URL. I am not able to find an error in debug mode.

Please help me with what I am doing wrong.



capture.png (7.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jul 04, 2017 at 11:10 AM


    Please find below the view definition. I guess in your case the model which your binidng is more important. I created and XML view

    <mvc:View controllerName="mysap.ui5.demo.walk.controller.App" xmlns:html="" xmlns:mvc="sap.ui.core.mvc"
    	xmlns="sap.m" xmlns:u="sap.ui.unified">
    			<Page title="{i18n>title}">
    					<!--<u:Currency value="2300.12" currency="INR" useSymbol="true" />-->
    					<Text text="{ path: '/number', type: 'sap.ui.model.type.Currency', formatOptions: { showMeasure: false } }"/>
    					<!--<Text text="Hello World"/>-->
    					<Link id="Test" text="Link1" href="{path: '/link1'}"></Link>
    					<Link id="Test2" text="Link2" href="{path: '/link2'}"></Link>

    The controller definition is as follows

    	"sap/ui/core/mvc/Controller", "sap/ui/model/json/JSONModel",
    ], function(Controller, JSONModel, NumberFormat) {
    	"use strict";
    	return Controller.extend("mysap.ui5.demo.walk.controller.App", {
    		_data: {
    			"number": ["9999.99"],
    			"link1" : '',
    			"link2" : ''
    		onInit: function(evt) {
    			var oModel = new JSONModel(this._data);
    			var oFmtSet =  NumberFormat.getCurrencyInstance();
    			// var oLocale = oFmtSet.getCurrencyInstance();



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 04, 2017 at 07:39 AM

    Hi Meenakshi,

    Can you try with 'Press' event in sap.m.Link..

    I am not sure are you setting href value dynamically for the link.


    Mahi theja

    Add comment
    10|10000 characters needed characters exceeded