Skip to Content
avatar image
Former Member

Error: Cannot set property '_oTargetHandler' of undefined sapui5

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 26, 2017 at 03:24 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Steve,

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

      Regards,

      Rachit.

  • avatar image
    Former Member
    May 31, 2017 at 03:22 PM

    Hi Steve,

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

    Thanks.

    Regards,

    Rachit.

    Add comment
    10|10000 characters needed 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