Skip to Content

clear values from UI5 screen

Hi,

I am devloping an app to change the address of an employee. There are two views in the app. First view (View1) has two parameters, Employee# and Pin# and GO button. Second view(view2) has address and BACK navigate button. The address fields are added on Form layout.

1. I gave Empl1 and Pin# ans clicked on GO button. It navigated to View2 with Address of Empl1.

2. I clicked on BACK button. came back to View1. initial parameters are cleared.

3. Entered new values Empl2 and Pin#2 and clicked on GO.

4. View2 is still showing Empl1's address.

5. I removed oData record on BACK button.

6. on GO, it is retrieving new record. But View2 is still showing old values.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 07 at 11:50 PM

    your code???

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jun,

      While navigating from Vew1 to View2, On_init method from View2.. During this step..Address record will be retrieved from backend system. For any Employee#, this is working fine. But it is not clearing previous record from oModel.oData. insteda it is appending to oData. And reading first record always (First Employee#) and displaying on voew.

      var sForm = this.getView().byId("AdrForm");

      sForm.bindElement( "/Adrchg_etSet('" + oEvt.getParameter("arguments").Pernr + "')");

      While navigating from View2 to View1, on BACK button from View2..

      Eventhough I clear records from oData, old values are not clearing from View2->Page-Form. I need to clear these from Form and rebind the new record.

      var pModel = this.getOwnerComponent().getModel();

      pModel.oData = {};

      pModel.mContexts = {};

      var sForm = this.getView().byId("AdrForm");

      sForm.setBindingContext(null);

      var oRouter = sap.ui.core.UIComponent.getRouterFor(this);

      oRouter.navTo("Route_Key");