控制器的onExit事件(?)中的元数据不可用

时间:2019-04-25 11:25:01

标签: sapui5

尝试在详细信息控制器的onExit函数中使用一些代码,以调用函数导入,当用户从此处按下顶部主启动板按钮时,该函数将“释放”我的记录。虽然当时一切似乎都可用(错误后检查快照),但我调用了import函数,但出现以下错误:

Uncaught (in promise) TypeError: Cannot read property '_getFunctionImportMetadata' of undefined
    at eval (eval at evalModuleStr (jquery.sap.global-dbg.js:3315), <anonymous>:2607:463)
    at eval (eval at evalModuleStr (jquery.sap.global-dbg.js:3315), <anonymous>:2603:192)
(anonymous)	@	VM32:2607
(anonymous)	@	VM32:2603
Promise.then (async)		
r._processRequest	@	VM32:2603
r.callFunction	@	VM32:2607
(anonymous)	@	Object.controller.js?eval:205
onExit	@	Object.controller.js?eval:202
a.fireEvent	@	EventProvider-dbg.js:229
a.fireEvent	@	Element-dbg.js:593
(anonymous)	@	ManagedObjectMetadata-dbg.js:426
c.exit	@	VM32:917
f.exit	@	VM32:954
h.destroy	@	ManagedObject-dbg.js:2270
a.destroy	@	Element-dbg.js:555
b.destroy	@	Control-dbg.js:602
f.destroy	@	VM32:960
destroy	@	VM32:1111
c._destroyCreatedInstances	@	VM32:531
c.destroy	@	VM32:530
destroy	@	Component.js?eval:302
s	@	VM32:86
d.exit	@	VM32:91
h.destroy	@	ManagedObject-dbg.js:2270
a.destroy	@	Element-dbg.js:555
b.destroy	@	Control-dbg.js:602
h.destroyAggregation	@	ManagedObject-dbg.js:1974
j	@	VM33:1326
exit	@	VM33:1343
A.exit	@	VM33:1861
h.destroy	@	ManagedObject-dbg.js:2270
a.destroy	@	Element-dbg.js:555
b.destroy	@	Control-dbg.js:602
onAfterNavigate	@	VM33:1861
p	@	jquery-dbg.js:497
a.fireEvent	@	EventProvider-dbg.js:229
a.fireEvent	@	Element-dbg.js:593
(anonymous)	@	ManagedObjectMetadata-dbg.js:426
(anonymous)	@	VM33:2722
sap.ushell.ui.launchpad.ViewPortContainer._handleViewPortTransition	@	VM33:2730
sap.ushell.ui.launchpad.ViewPortContainer._setCurrentlyDisplayedControl	@	VM33:2724
sap.ushell.ui.launchpad.ViewPortContainer.navTo	@	VM33:2722
_handleEmbeddedNavMode	@	VM33:1861
(anonymous)	@	VM33:1861
p	@	jquery-dbg.js:3187
add	@	jquery-dbg.js:3246
navigate	@	VM33:1861
_initiateApplication	@	VM33:1861
(anonymous)	@	VM33:1861
p	@	jquery-dbg.js:3187
add	@	jquery-dbg.js:3246
doHashChange	@	VM33:1861
p	@	jquery-dbg.js:497
sap.ushell.services.ShellNavigationHashChanger.treatHashChanged	@	VM33:2188
execute	@	VM32:3214
dispatch	@	VM32:3217
dispatch	@	VM32:3216
(anonymous)	@	VM32:3204
i	@	VM32:3204

我的模型似乎仍然如调试器所建议的那样(请参见下文),并且当我使用后退按钮导航到该代码(应该成为通用功能,在此处复制用于测试目的)时,它运行得很好我的主要观点。当然,后端方法不会被调用。代码附在末尾。有任何想法吗?

enter image description here

		onExit: function() {
			var oParamModel = this.getView().getModel("Global");
			var oModel = this.getView().getModel();
			if (oParamModel.getProperty("/RecordUnlocked") === true) {
				var unlockOnExit = new Promise(function(resolve, reject) {
					oParamModel.setProperty("/RecordUnlocked", true);
					var sAgreement = oParamModel.getProperty("/AgreementID");
					oModel.callFunction("/Agreement_Unlock", {
						method: 'GET',
						urlParameters: {
							"Agreement_Code": sAgreement
						},
						success: function(oData, response) {
							resolve(oData);
						},
						error: function(oError) {}
					});
				});
				
				var callFetch = function () {
				    unlockOnExit
				        .then(function (fulfilled) {
				        })						  		
				        .catch(function (error) {
	
				        });
				};
				
				callFetch();	
			}
		},

0 个答案:

没有答案