我是一個很新的sapui5並在list.view.js一以下情形,我定義一個簡單的表:
(function() {
"use strict";
sap.ui.jsview("fst.app.cList", {
getControllerName: function() {
return "fst.app.cList";
},
createContent: function (oController) {
//Back button
var oBackButton = new sap.m.Button({
text: "Back",
icon: "sap-icon://arrow-left",
press: oController.handleButtonPress
});
//New contract button
var oNewButton = new sap.m.Button({
text: "New",
icon: "sap-icon://add-document",
press: oController.addNewButtonPress
});
//Spacer
var oSpacer = sap.m.ToolbarSeparator();
//Table body
var oTable = sap.m.Table({
insert: true,
headerText: "List of Items",
headerDesign: sap.m.ListHeaderDesign.Standard,
mode: sap.m.ListMode.None,
includeItemInSelection: false
});
//Columns
var col01 = new sap.m.Column("col01", {
header: new sap.m.Label({
text: "Number"
})
});
oTable.addColumn(col01);
var col02 = new sap.m.Column("col02", {
header: new sap.m.Label({
text: "Product"
})
});
oTable.addColumn(col02);
var col03 = new sap.m.Column("col03", {
header: new sap.m.Label({
text: "Date"
})
});
oTable.addColumn(col03);
var colItems = new sap.m.ColumnListItem("colItems", {
type: "Active"
});
oTable.bindAggregation("items", "/value", colItems);
var txtNAME = new sap.m.Text("txtNAME", {
text: "{ProductID}"
});
colItems.addCell(txtNAME);
var txtNAME2 = new sap.m.Text("txtNAME2", {
text: "{ProductName}"
});
colItems.addCell(txtNAME2);
var txtNAME3 = new sap.m.Text("txtNAME3", {
text: "{UnitsInStock}"
});
colItems.addCell(txtNAME3);
var page = new sap.m.Page({
title: "Test",
enableScrolling: false,
content: [oBackButton, oSpacer, oNewButton, oTable]
});
return page;
}
});
})();
當按鈕(oNewButton)被點擊新視圖將被稱爲(new.view.js)。在這個視圖中,我想使用第一個視圖中的列來創建表單。
任何人都可以給我一些tipps如何以最好的方式實現這樣的場景嗎?
在此先感謝和問候。 Denis