cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass data from one view to another xml view

Former Member
0 Kudos

Hi Experts,

I need to pass data from a one view to another by taking data from user in textfield and show it in other view using simple text control.

for navigation i'm using routing

metadata : {

  routing : {

  config : {

  viewType:"XML",

  viewPath:"view",

  targetControl:"navContainer",

  targetAggregation:"pages",

  clearTarget : false

  },

  routes : [

         

          {

          pattern : "",

          name : "adminHome",

          view : "adminHome"

          },

          {

          pattern : "Home",

          name : "Home",

          view : "Home"

          }

        

          ]

  }

  }

Regards,

Rajesh Roy

Accepted Solutions (0)

Answers (2)

Answers (2)

santhu_gowdaz
Active Contributor
0 Kudos
vishnucta
Active Participant
0 Kudos

i think these are all not based on Routing.

In Routing context cannot be passed as Json String

Regards,

Vishnu

Former Member
0 Kudos

Hello Vishnu,

Did you manage to resolve this issue. Even I have similar problem where I am not able to fetch the data in the detail view from master view (from View 1 to view 2). How can we modify the route pattern to fit our requirement.

Regards

-Sandip

Former Member
0 Kudos

I don't see the problem here. Why don't you create a for example json model that is attached to the component and bind the Inputfield as well as the Textfield to the same property?

rauf_shaikh
Active Participant
0 Kudos

Hi Rajesh,

Using navTo() you can call another view and pass data to the another. You will have to update your routes as follows:


{

          pattern : "Home/{data}",

          name : "Home",

          view : "Home"

}

you can call another view say "Home" as follows:


this.oRouter.navTo("Home",{

     data : "yourData value";

});

and in your Home view controller init() you can get the data as follows:


oView=this.getView();

var dataPassed;

oDataModel = this.oApplicationFacade.getODataModel();

this.oRouter.attachRouteMatched(function(oEvent) {

         oViewName = oEvent.getParameter("name");

         if (oViewName === "Home") {

              dataPassed= oEvent.getParameter("arguments").data;

         }

});

Regards,

Rauf

Former Member
0 Kudos

Hi Rauf,

I got an Error  " Cannot read property 'getODataModel' of undefined ".

Can you provide some reference from where i can learn more about Routing and how to apply it in my project.

Regards,

Rajesh Roy

vishnucta
Active Participant
0 Kudos

Hi Mate

As u said i have changed the component.js

  1. {
  2.           pattern : "Home/{ctx}",
  3.           name : "Home",
  4.           view : "Home"
  5. }

i tried to bring the context to detail page but still i am not able to see the properties in evt object

Master Page Controller:

sap.ui.core.UIComponent.getRouterFor(this).navTo("porder", {
//from: "main",
product: oItem.getBindingContext('Northwind').getPath().substr(1),
//ctx : bindingContext
//tab: "supplier"
}, false);

Component.js:

    pattern:"porderDetail/{product}",
name : "porder",
viewPath : "com.viz.view.Detail",
view : "Detail",
//viewLevel : 1,
targetControl : "splitApp_viz",
targetAggregation : "detailPages"
}

i am not able bind any thing in the detail xml view

below i have mentioned the screens...

My Detail view still look empty: