-1
我看到一個this expamle,我想玩我。SAPUI5中的個性化表
這是我的XML視圖:
<Panel>
<content>
<Button press="onPersoButtonPressed" class="btn editTable"></Button>
</content>
</Panel>
<Table id="Listing" class="tableList" mode="MultiSelect" items="{path: 'masterData>/contactsList'}">
<columns>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>vendorNum}"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>recipientType}"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="{i18n>eMail}"/>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{masterData>vendorNum}"/>
</cells>
<cells>
<Text text="{masterData>recipientType}"/>
</cells>
<cells>
<Text text="{masterData>eMail}"/>
</cells>
</ColumnListItem>
</items>
</Table>
這是我的控制器:
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/core/routing/History",
"sap/ui/model/json/JSONModel",
"sap/ui/test/controller/TopMenu.controller",
"sap/m/TablePersoController",
"sap/ui/model/resource/ResourceModel"
], function (Controller,History,JSONModel,TopMenu,ResourceModel,TablePersoController) {
"use strict";
jQuery.sap.require("sap.ui.core.util.Export");
jQuery.sap.require("sap.ui.core.util.ExportTypeCSV");
return Controller.extend("sap.ui.test.controller.MasterData", {
onInit : function() {
var oData = {
contactsList:[
{
vendorNum: '101938',
recipientType: 'Promo',
supplierName: 'Company name'
},
{
vendorNum: '101936',
recipientType: 'Abcd',
supplierName: ''
},
{
vendorNum: '101933',
recipientType: 'Xyz',
supplierName: 'Comp.Name',
beCode: '0108'
}
]
};
var oModel = new JSONModel(oData);
this.getView().setModel(oModel, "masterData");
var i18nModel = new ResourceModel({
bundleName: "sap.ui.lenta.i18n.i18n"
});
this.getView().setModel(i18nModel, "i18n");
this._oTPC = new TablePersoController({
table: this.getView().byId("Listing"),
componentName: "test"
}).activate();
},
onPersoButtonPressed: function (oEvent) {
this._oTPC.openDialog();
},
onTablePersoRefresh : function() {
//DemoPersoService.resetPersData();
this._oTPC.refresh();
},
onTableGrouping : function(oEvent) {
this._oTPC.setHasGrouping(oEvent.getSource().getSelected());
},
//.....
這個例子拋出一個錯誤:Uncaught Error: Property "appDescription" does not exist in ManagedObject sap.m.TablePersoController#__controller0
。在這種情況下,存在於manifest.json中的字符串" description ":" {{app Description}} "
和存在於i18n.properties
中的說明字符串。
我不知道我錯過了什麼?如何使這個代碼工作?或者我需要使用其他方法來解決表格列的操作問題嗎?
你可以在jsbin例子中添加代碼嗎?如果沒有真正的代碼示例,很難找出根本原因 – Veeraraghavan
@Veeraraghavan,如果添加''sap/ui/test/controller/TopMenu.controller''行,則會出現問題。在這裏,據我瞭解麻煩不在主代碼中。 – sanu0074