[英]Personalization table in SAPUI5
I saw an this expamle, and I want to play it at me. 我看到了这个故事,我想对我玩。
This is my xml view: 这是我的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>
And this is my controller: 这是我的控制器:
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());
},
//.....
That example throwing an error: Uncaught Error: Property "appDescription" does not exist in ManagedObject sap.m.TablePersoController#__controller0
. 该示例抛出错误: Uncaught Error: Property "appDescription" does not exist in ManagedObject sap.m.TablePersoController#__controller0
。 In this case, the string " description ":" {{app Description}} "
present in manifest.json, and description string exist in i18n.properties
. 在这种情况下,清单" description ":" {{app Description}} "
i18n.properties
" description ":" {{app Description}} "
存在字符串" description ":" {{app Description}} "
,而i18n.properties
存在描述字符串。
I can not figure out what I missed? 我不知道我错过了什么? How to make that this code worked? 如何使此代码有效? Or do I need to use something else to solve the problem with the actions of the table-columns? 还是我需要使用其他方法来解决表列的操作问题?
You created wrong mapping of object names with class names. 您使用类名称创建了错误的对象名称映射。
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,TablePersoController, ResourceModel) {
"use strict";
Here ResourceModel object should be interchanged with TablePersoController as mentioned above. 如上所述,此处应将ResourceModel对象与TablePersoController互换。
Because TablePersoController was referring to class mentioned for ResourceModel, it was not properly working. 因为TablePersoController引用的是为ResourceModel提及的类,所以它无法正常工作。
Change the order and the error should be resolved. 更改顺序,错误应得到解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.