点击此处---> 群内免费提供SAP练习系统(在群公告中)
加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)
尊敬的专家,
我正在尝试从详细视图中的扩展实体获取上下文,但是当我使用expand参数时,它仅返回键列表。
有人可以帮我吗?
这是我的代码:
onInit:函数(){ var oViewModel = new JSONModel({ 忙:错误, 延迟:0 lineItemListTitle:this.getResourceBundle()。getText(" detailLineItemTableHeading") }); this.getRouter()。getRoute(" object")。attachPatternMatched(this._onObjectMatched,this); this.setModel(oViewModel," detailView"); this.getOwnerComponent()。getModel()。metadataLoaded()。then(this._onMetadataLoaded.bind(this)); }, _onObjectMatched:函数(oEvent){ var sObjectId = oEvent.getParameter(" arguments")。objectId; this.getModel(" appView")。setProperty("/img/layout"," TwoColumnsMidExpanded"); this.getModel()。metadataLoaded()。then(function(){ var sObjectPath = this.getModel()。createKey(" Categories",{ CategoryID:sObjectId }); this._bindView("/" + sObjectPath); } .bind(this)); }, _bindView:函数(sObjectPath){ //在视图绑定期间设置忙碌指示器 var oViewModel = this.getModel(" detailView"); oViewModel.setProperty("/img/busy",false); this.getView()。bindElement({ 路径:sObjectPath, 参数:{ 展开:"产品" }, 事件:{ 改变:this._onBindingChange.bind(this), dataRequested:function(){ oViewModel.setProperty("/img/busy",true); }, dataReceived:function(){ oViewModel.setProperty("/img/busy",false); } } }); }, _onBindingChange:函数(){ var oView = this.getView(), oElementBinding = oView.getElementBinding(); //没有用于绑定的数据 如果(!oElementBinding.getBoundContext()){ this.getRouter()。getTargets()。display(" detailObjectNotFound"); //如果找不到对象,则在主列表中进行选择 //不再有意义。 this.getOwnerComponent()。oListSelector.clearMasterListSelection(); 返回; } var sPath = oElementBinding.getPath(), oResourceBundle = this.getResourceBundle(), oObject = oView.getModel()。getObject(sPath), sObjectId = oObject.CategoryID, sObjectName = oObject.CategoryName, oViewModel = this.getModel(" detailView"), oBindingContext = this.getView()。getBindingContext()。getObject(); console.log(" Object",oObject); this.getOwnerComponent()。oListSelector.selectAListItem(sPath); oViewModel.setProperty("/img/shareSendEmailSubject", oResourceBundle.getText(" shareSendEmailObjectSubject",[sObjectId])); oViewModel.setProperty("/img/shareSendEmailMessage", oResourceBundle.getText(" shareSendEmailObjectMessage",[sObjectName,sObjectId,location.href]))); },
输出:
预期输出:
(45.7 kB)
odata模型正以这种方式组织数据。
您遇到什么问题?
您好,Jun,
我想访问输出图像中显示的Array中每个项目的"预期输出"图像中显示的数据(ProductID,ProductName,...):
一周热门 更多>