Skip to Content

Create UI element dynamically and display those UI in XML view

I am creating SAP UI5 application using XML view paradigm in eclipse:

I have created horizontal box like below in XML view

<HBox xmlns="sap.m" id="H34" busy="false" busyIndicatorDelay="1000"

visible="true" height="" width="100%" displayInline="false"

direction="Row" fitContainer="false" renderType="Div"

justifyContent="Start" alignItems="Stretch">

<tooltip></tooltip><!-- sap.ui.core.TooltipBase -->

<dependents></dependents><!-- sap.ui.core.Control, since 1.19 -->

<items>

Here need to show Input dynamically

</items><!-- sap.ui.core.Control -->

</HBox>

My requirement is to create Input field dynamically and display those fields under above XML view items( pointed in Bold).

Please help me out in this.

Regards

Vincent

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 30, 2017 at 12:27 PM

    YOURHBOX =this.byId(hboxid)

    YOURHBOX.addItem(YOURDYNAMICCONTROL)

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 31, 2017 at 07:48 AM

    I have added as per your suggestion as below in JS controller.

    var hBox = this.getView().byId("H34");

    item = hBox.addItem(new sap.m.Label("BBN", "Test label"));

    Now, how i need to display this UI in XML view . It means, how can i call this UI element in XML view

    Explain me with sample code

    Thank you.

    Vincent

    Add comment
    10|10000 characters needed characters exceeded