$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
0

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

Apr 19, 2017 at 10:44 AM

79

avatar image
Former Member

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;},
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Veeraraghavan Narasimhan
Apr 19, 2017 at 03:42 PM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

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

1
Jun Wu Apr 19, 2017 at 12:40 PM
0

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

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.

0