Skip to Content
0

Error: Cannot set property '_oTargetHandler' of undefined sapui5

May 26, 2017 at 03:17 PM

192

avatar image

Dear Experts,

I am stuck in a SAP UI5 application that is throwing an error "Cannot set property '_oTargetHandler' of undefined". I am learning routing in SAPUI5.

Files Layout:

Please find the attached code.

code.txt

Thanks in Advance.

Regards,

Rachit.

file-layout.jpg (26.7 kB)
code.txt (2.7 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Steve Guo
May 26, 2017 at 03:24 PM
0

Hi Rachit

Try as follow.

in the code , the viewPath is not need because you have already written in the config section which is the default value for your targets.

And if you want to write it, you should not include the viewName in viewPath.

"target": {
					"master": {
						"viewName": "Master",
						"viewPath": "sapui5.demo.mvcapp.MVC1.webapp.view.Master",
						"viewType": "XML",
						"viewLevel": 1,
						"transition": "slide",
						"clearAggregation": "true"
					}
				}

Another thing is your controller code.

The controller code should write in controller of the Master view, not view App's controller.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Steve,

Thanks for the response. I made the changes you suggested by I am still facing the same issue.

Regards,

Rachit.

0
Rachit Goyal May 31, 2017 at 03:22 PM
0

Hi Steve,

Can you please help me here. I am stuck in this issue.

Thanks.

Regards,

Rachit.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

The code you have written is based on old architecture, I would strongly recommend you to use the latest manifest file to store the routing information and use the component to load the manifest and instantiate the routing.

Moreover I've observed that you are calling "

sap.m.routing.RouteMatchedHandler"

,which is deprecated .


As i can see that you are already using the WebIDE, try to create a master detail application using the master detail template, which will generate 99% of the code to run your application with proper routing configuraiton, later on you can tweak your code.

Best Regards,

Mahesh

0