Skip to Content
3
Jun 15, 2020 at 08:19 PM

Cannot set property "oView" of undefined error with mvc Controller at Fiori Elements

1889 Views

Hi all,

I had create a List Report application with Fiori Elements, and I'm receiving an error when I try to use mvc controller in place of sap.ui.controller at the controller extension. Currently i'm using SAPUI5 1.60.27 version.

I've defined an controller extension that it's working fine when I use sap.ui.controller:

sap.ui.define([
	"sap/ui/core/mvc/Controller"
], function(Controller) {
	"use strict";
	
	var oController = {
		onInit: function() {
		},
		
		adaptNavigationParameterExtension: function(oSelectionVariant, oObjectInfo) {
		}
	};
	
	return sap.ui.controller("com.sap.myapp.ext.controller.ListReportExtension", oController); 
}); 

When I try to use the mvc controller instead of "sap.ui.controller", I do receive an error on method "connectToView" of class sap.ui.core.mvc.View.

//Using "sap/ui/core/mvc/Controller" 
return Controller.extend("com.sap.myapp.ext.controller.ListReportExtension", oController); 

//return sap.ui.controller("com.sap.myapp.ext.controller.ListReportExtension", oController); 

This error seems to occur because the method "connectToView" it's called in asynchrounous mode (as Promise), and the oController object it's undefined when de promise executes. Anyone knows what could cause this issue?

Attachments

ogu25.png (37.2 kB)
zlb1a.png (60.2 kB)
3opph.png (6.6 kB)
4fb1o.png (15.4 kB)