简体   繁体   English

SapUI5表-找不到404错误

[英]SapUI5 Table - 404 not found error

I have started to learn sap ui5. 我已经开始学习SAP ui5。 I follow a tutorial to create a table here's what i've got. 我按照教程创建表,这是我所拥有的。

index.html: index.html的:

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

        <script src="resources/sap-ui-core.js"
                id="sap-ui-bootstrap"
                data-sap-ui-libs="sap.ui.commons, sap.m, sap.ui.table, sap.ui.model, sap.ui.model.json"
                data-sap-ui-theme="sap_bluecrystal">
        </script>
        <!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->

        <script src="app/data.js"></script>
        <script src="app/app.js"></script>

    </head>
    <body class="sapUiBody" role="application">
        <div id="content"></div>
    </body>
</html>

app.js app.js

var oTable = new sap.ui.table.Table({
    title: "My first table",
    visibleRowCount: 5,
    firstVisibleRow: 2,
    selectionMode: sap.ui.table.SelectionMode.Single,
    toolbar: new sap.ui.commons.Toolbar({
        items: [
            new sap.ui.commons.Button({
                text: "Toolbar button",
                press: function() {
                    alert("Toolbar button pressed");
                }
            })
        ]
    }),
    extenstion: [
        new sap.ui.commons.Button( {
            text: "Extenstion button",
            press: function() {
                alert("Extenstion button pressed");
            }
        })
    ]
});

oColumn = new sap.ui.table.Column({
    label: new sap.ui.commons.Label({
        text: "Last name"
    }),
    template: new sap.ui.commons.TextView().bindProperty("text", "lastName"),
    sortProperty: "lastName",
    filterProperty: "lastName",
    width: "200px"
});

var oCustomMenu = new sap.ui.commons.Menu();
oCustomMenu.addItem(new sap.ui.commons.MenuItem({
    text: "Custom Menu",
    select: function() {
        alert("Custom menu");
    }
}));

oColumn.setMenu(oCustomMenu);
oTable.addColumn(oColumn);

oTable.addColumn(new sap.ui.table.Column({
    label: new sap.ui.commons.Label({
        text: "ID"
    }),
    template: new sap.ui.commons.TextField().bindProperty("value", "firstName"),
    sortProperty: "name",
    filterProperty: "name",
    width: "100px"
}));

oTable.addColumn(new sap.ui.table.Column({
    label: new sap.ui.commons.Label({
        text: "First name"
    }),
    template: new sap.ui.commons.TextField().bindProperty("value", "firstName"),
    sortProperty: "name",
    filterProperty: "name",
    width: "100px"
}));

oTable.addColumn(new sap.ui.table.Column({
    label: new sap.ui.commons.Label({
        text: "First name"
    }),
    template: new sap.ui.commons.TextField().bindProperty("value", "firstName"),
    sortProperty: "name",
    filterProperty: "name",
    width: "100px"
}));

var oModel = new sap.ui.model.json.JSONModel();
oModel.setData({
    modelData: data
});

oTable.sort(oTable.getColumns()[0]);
oTable.placeAt("content");

data.js: data.js:

var data = [
    {firstName: "Michal", lastName: "Kohut", id: 358, phone: 4584250, rating: 5},
    {firstName: "Jan", lastName: "Pribrzdený", id: 157, phone: 1325124, rating: 1},
    {firstName: "Milena", lastName: "Dnesmameninova", id: 874, phone: 3698548, rating: 4}
]

I'm doing this in eclipse with sapui5 plugins. 我正在使用sapui5插件在Eclipse中进行此操作。 When i run i get this errors: 当我运行时,出现以下错误:

错误讯息

I'm really new to javascript and sapui5. 我真的是javascript和sapui5的新手。 Could you help me figure it out? 你能帮我弄清楚吗?

sap.ui.model and sap.ui.model.json are unnecessary in your data-sap-ui-libs declaration in the index.html. 在index.html中的data-sap-ui-libs声明中,不需要sap.ui.modelsap.ui.model.json Remove both libs in the statement. 删除语句中的两个库。

Try it just with: 尝试一下:

<script src="resources/sap-ui-core.js" 
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons, sap.m, sap.ui.table"
data-sap-ui-theme="sap_bluecrystal">
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM