cancel
Showing results for 
Search instead for 
Did you mean: 

Change elements of subview

Former Member
0 Kudos

Hi,

i have a view where another view is embedded:


<mvc:View controllerName="account.controller.Main" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">

  <App>

  <pages>

  <Page title="{i18n>title}">

  <content>

  <sap.ui.layout.form:SimpleForm ariaLabelledBy="__text5" columnsL="1" columnsM="1" editable="true" emptySpanL="1" emptySpanM="1" id="__form0"

  labelSpanL="4" labelSpanM="4" layout="ResponsiveGridLayout" maxContainerCols="2" xmlns:sap.ui.layout.form="sap.ui.layout.form">

  <sap.ui.layout.form:content>

  <Label labelFor="idFertigungsauftrag" text="{i18n>Fertigungsauftrag}"/>

  <Input busy="false" editable="true" id="idFertigungsauftrag" width="100%"/>

  </sap.ui.layout.form:content>

  </sap.ui.layout.form:SimpleForm>

  <mvc:XMLView viewName="account.view.Rueckmeldung"/>

  </content>

  <footer>

  <Toolbar>

  <ToolbarSpacer/>

  <Button icon="sap-icon://accept" id="idConfirmBtn" press="onPressConfirmBtn" text="{i18n>Rueckmelden}" type="Accept"

  visible="true"/>

  <Button icon="sap-icon://sys-cancel" id="idCancelBtn" press="onPressCancelBtn" text="{i18n>Abbrechen}" type="Reject"

  visible="true"/>

  </Toolbar>

  </footer>

  </Page>

  </pages>

  </App>

</mvc:View>

In this subview I have input fields. Over the button in the footer I want to clear the input fields of the subview.

Within this button-method, I can call a function of the controller of the subview: sap.ui.controller("hauni.controller.Rueckmeldung").clear();

But within this function, I can not access this and so I can not get the elements of the view


clear: function() {
this.byId("idGutmenge").setValue("");
this.byId("idAusschuss").setValue("");
this.byId("idEntlohnungsmenge").setValue("");
this.byId("idNCProgrammnummer").setValue("");

}

Has anybody an idea how to handle this?

Thank you in advance!

Bastian

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

use eventbus to enable communication between views.

google it.

Former Member
0 Kudos

Thank you, this was a perfect hint.

Found the solution in

Answers (0)