on 04-19-2017 11:44 AM
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;},
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.