Skip to Content
0
Former Member
Oct 31, 2017 at 12:31 PM

SAPUI5 (jQuery) changes

206 Views

Hi guys,

I have some issues with the new release :)

For starters I'll link the MVC data

1. The view

<View 
	controllerName="generated.app.controller.pdf" 
	xmlns:m="sap.m" 
	xmlns:html="http://www.w3.org/1999/xhtml">
	<m:Label id="NameID" text="{PDF>mapUrl}" design="Bold"/>
	<html:div id="divPdf" style="height:100%">
		<html:iframe src="{PDF>mapUrl}" id="pdfFrame" style="width:100%;height:100%;overflow:visible"></html:iframe>
	</html:div>
</View>

2. And the controller:

		onInit: function() {
			var oModelPDF = new sap.ui.model.json.JSONModel();
			this.getView().setModel(oModelPDF, "PDF");
		},
onBeforeRendering: function() {
			var url = "https://www.dhs.state.or.us/policy/spd/transmit/ar/2017/ar17048.pdf";
			var model = this.getView().getModel("PDF");
			var data = {
				"mapUrl": url
			};
			model.setData(data);
			model.updateBindings();
		},
		onAfterRendering: function() {
			var url = "https://www.dhs.state.or.us/policy/spd/transmit/ar/2017/ar17048.pdf";
			var model = this.getView().getModel("PDF");
			var data = {
				"mapUrl": url
			};
			model.setData(data);
			model.updateBindings();
		}

What I'mt trying to achieve is to access the named model of my page. Sounds simple but I get "HTTP Status 404 - Not Found" and not because the link isn't accessible.

Although I can access the data in my model with the "usual" commands

code: sap.ui.getCore().byId("__component0---pdf").getModel("PDF").getData().mapUrl
answer: "https://www.dhs.state.or.us/policy/spd/transmit/ar/2017/ar17048.pdf"

The view can't access the model.

Any idea why ?

Kind regards,

Petru

PS: I even tried other ways to access the data model:

<m:Label id="NameID" text="{	path: '{PDF>mapUrl}' }" design="Bold"/>