Skip to Content

How to use one view id in another view controller sap ui5

Hi,

I have a Master Detail Page application. As of now, I am using Master Page UI eleemnt control Id sap.ui.getCore().byId("_xmlview0--inputid") in Detail View Controller. I know this is not right practice. My doubt is how to use one view control id in another view controller.

Regards

Karthik S

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Aug 09, 2017 at 04:54 PM

    Why do you want to access a control id in one view to another view??

    In general we access the data attached to the control id that is avilable in a different view using models

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 09, 2017 at 08:10 PM

    When you create a control(XML or JS), assign a unique ID. Ex: <button id="myButton">

    When it renders, the framework will assign the view, i.e. xmlview1_mybutton.

    You can get the control in your controller, using the code this.getView().byId("myButton") and avvoid the need to append the view id(which is assigned dynamically).

    Regards,

    Sharath

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 09, 2017 at 08:10 PM

    When you create a control(XML or JS), assign a unique ID. Ex: <button id="myButton">

    When it renders, the framework will assign the view, i.e. xmlview1_mybutton.

    You can get the control in your controller, using the code this.getView().byId("myButton") and avvoid the need to append the view id(which is assigned dynamically).

    Regards,

    Sharath

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 10, 2017 at 05:55 AM

    Thank you everyone for your suggestions.

    Regards

    Karthik S

    Add comment
    10|10000 characters needed characters exceeded