I am trying to create a sapui5 table from xml view but it doesn't seem to be working when I run it from visual studio but when I run it in jsfiddle it runs just fine. What is the reason for this?
Here is the code in my xmlTest.hml:
<!DOCTYPE html>
<html>
<head>
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.ui.commons,sap.ui.table"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body class="sapUiBody" id="content">
<script id="view1" type="ui5/xmlview">
<core:view xmlns:core="sap.ui.core"
xmlns="sap.ui.commons"
xmlns:table="sap.ui.table"
xmlns:html="http://www.w3.org/1999/xhtml"
controllername="view.Main">
<table:table width="100%" visiblerowcount="5" selectionmode="Single" editable="false" rows="{/data}">
<table:title><label text="XML View"></label></table:title>
<table:column>
<label text="Row Num" />
<table:template><textfield value="{rowNum}"></textfield></table:template>
</table:column>
<table:column>
<label text="ID" />
<table:template><textfield value="{id}"></textfield></table:template>
</table:column>
<table:column>
<label text="First Name" />
<table:template><textfield value="{name}"></textfield></table:template>
</table:column>
<table:column>
<label text="Email Address" />
<table:template><textfield value="{email}"></textfield></table:template>
</table:column>
</table:table>
</core:view>
</script>
<script type="text/javascript">
var aData = [
{ rowNum: 1, id: 42, name: "Anthony", email: "anthony@example.com" },
{ rowNum: 1, id: 42, name: "Anthony", email: "anthony@example.com" },
{ rowNum: 1, id: 42, name: "Anthony", email: "anthony@example.com" },
];
sap.ui.controller("view.Main", {
doSomething: function (oEvent) { }
});
var oView = sap.ui.xmlview({
viewContent: jQuery("#view1").html()
});
var oModel = new sap.ui.model.json.JSONModel({
data: aData
});
oView.setModel(oModel);
oView.placeAt("content");
</script>
</body>
</html>
Running this code from visual studio I get the following errors:
These errors refer to this file.
When I copy my code into jsfiddle it works just fine. Here is my jsfiddle.