cancel
Showing results for 
Search instead for 
Did you mean: 

sap/ui/demo/wt/controller/HelloDialog - Unable to comprehend

Former Member
0 Kudos

Hi Experts,

The tutorial code for "Resue Dialogs" is too hard for me to understand.

Just a bit of inslight would make my life easier.

How is "

sap/ui/demo/wt/controller/HelloDialog" this been added in component.js when sap/ui/demo isn't a library ( or namespace) in the standard?

Further there is one more code -

What is oView here and what reference is it pointing to?

Much appreciated . Thanks, D

sap.ui.define(["sap/ui/base/Object"],function(UI5Object){"use strict";return UI5Object.extend("sap.ui.demo.wt.controller.HelloDialog",{constructor:function(oView){this._oView = oView;},

Accepted Solutions (1)

Accepted Solutions (1)

former_member228602
Contributor
0 Kudos

Hello D,

This is because of a concept called resource-roots . The webapp folder is always the root folder your application. If you check your index.html you will see that there is property called sap-ui-resourceroots and it points "./" for sap.ui.demo.wt . As a result whenever you encounter sap.ui.demo.wt it means that this an alias for webapp folder of your application(this is also alternatively called as namespace) . As a result to look for HelloDialog it is looking HelloDialog.js file in path sap.ui.demo.wt.controller which means inside the controller folder inside the webapp folder. Similarly this can also be maintained in manifest.json for launchpad specific applications.

Hope this helps.

Thanks and Regards,

Veera

Former Member
0 Kudos

Hi Veeraraghavan Narasimhan ,

Thanks for replying. However actually my confusion is over how this new namespace has been created.

As per the

sap/ui/demo/wt/controller/HelloDialog

this seems to be a custom namespace created.

And later this namespace is defined as a helloDialog.js file in -

sap.ui.define(["sap/ui/base/Object"],function(UI5Object){"use strict";return UI5Object.extend("sap.ui.demo.wt.controller.HelloDialog",{

Please let me know if my understanding for this is correct. Would appreciate your insights/

Regards,

Devashish

former_member228602
Contributor

Hello Devashish,

If you have followed the Walkthrough step in Step4-XML Views the namespace is defined.

sap.ui.define(["sap/ui/base/Object"],function(UI5Object){"use strict";return UI5Object.extend("sap.ui.demo.wt.controller.HelloDialog",{

The above line is registering the module and any reference to sap.ui.demo.wt.controller.HelloDialog would be resolved to the above js file.

In case your question is answered mark the answer suitably.

Thanks and Regards,

Veera

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

sap/ui/demo/wt this is the namespace. check your index.html(usually)

oView is the input parameter, when you instantiate the dialog, you will supply this.

just check the code where the dialog instance is created. you will get it.

Former Member
0 Kudos

Thanks Jun Wu . Gave me a better idea. 🙂

Could you let me know with a basic overview how this decoupling and abstract usage of dialogs is done in this code?

Regards,

Devashish

junwu
Active Contributor
0 Kudos

don't know what you are talking

it is just another ui5 object(or class created by you), it is same as the button, nothing more.