$(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
avatar image
Former Member

Running a custom method on a controls rendering from a XML view level in SAPUI5

I would like to implement some kind of ACL in a SAPUI5 XML view.

<Button 
    press="something"  
onBeforeRendering="customFunc"     />

Is there a way to launch the "customFunc" on some kind of "render"/"before render" event of the control? The "customFunc" is defined in a base controller (currently parent to the one that initializes the view and therefore - the control (in this case, a Button, but not always)).

The "customFunc" as mentioned above, is gonna have to be called in various controls. So is there a global method/event like the mentioned above "onBeforeRendering"?

Is this the best way of handling some globally available, custom methods (via the base controller)?

Add comment
10|10000 characters needed characters exceeded

  • Former Member Dheeram Kallem

    Hi Dheeram,

    The main problem is that I do not wan't to involve controllers into this, but simply call custom model methods (with attributes) from the XML view. The model has some globally available methods. Let's call the model simply MyModel. Then you call a method simply by going MyModel.MyCustomMethod(id-of-element-to-hide).

    Assuming that the method returns a certain value, could I go with something like this?

    <Button  
    enabled="MyModel.MyCustomMethod(some-id)"     />
  • Then use a formatter. In the formatter method you can write your own logic.

  • what are you talking?

  • Get RSS Feed

0 Answers