Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Using OpenUI5 xml views with cdn

This is the error that I get:

GET https://openui5.hana.ondemand.com/resources/ns/views/three-buttons.view.xml 404 (Not Found)

GET https://openui5.hana.ondemand.com/resources/ns/views/three-buttons.view.xml 404 (Not Found)

I am loading the sap-ui-core.js using a cdn. I would like to use xml views located in the viewsfolder and a controller in the controllers folder.

The script tags in the html look like:

<script id="sap-ui-bootstrap"

type="text/javascript"

  src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"

  data-sap-ui-theme="sap_bluecrystal"

  data-sap-ui-libs="sap.ui.commons"

  data-sap-ui-resource-roots="{ ns:'./' }" >

</script> 


<script>

$(function(){

sap.ui.xmlview('ns.views.three-buttons').placeAt('content');

  }); 

</script> 

This is my view:

<mvc:View xmlns="sap.m"

xmlns:mvc="sap.ui.core.mvc"

  controllerName="ns.controllers.three-buttons" >

  <TextView text="Hello World" tooltip="A tooltip for the data"/>

  <Button text="Show Alert" press="btnAlertClick" />

  <Button text="Show Confirm" press="btnConfirmClick" />

  <Button text="Show Message Box" press="btnShowClick" />

</mvc:View>

This is my controller:

sap.ui.controller('three-buttons',{


btnConfirmClick: function btnConfirmClick(){

sap.ui.commons.MessageBox.confirm('Do you want to proceed?',

function(){ new sap.ui.commons.MessageBox.alert('She said yes.'); },'Accept Marraige Proposal');

},


btnConfirmClick: function btnConfirmClick(){


sap.ui.commons.MessageBox.confirm('Do you want to proceed?',

function(){ new sap.ui.commons.MessageBox.alert('She said yes.');

},

'Accept Marraige Proposal');

},


btnShowClick: function btnShowClick() {


var icon = sap.ui.commons.MessageBox.ICON.Warning;

var actions = [sap.ui.commons.MessageBox.Action.YES,sap.ui.commons.MessageBox.Action.NO];

var callback = function(event) {

console.log('The event occurs here',event);

}

new sap.ui.commons.MessageBox.show('Are you sure you want to keep doing this',

icon,

'This could be dangerous',

actions,

callback,

sap.ui.commons.MessageBox.Action.CLOSE);

}

});

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question