0

Actually I have a problem with exchanging data between views. i have a view that conatains a selectable table and i want to get the data of the selected rows and navigate to another view to do the treatement of these data (i've already done the navigation stuff) i just don't know how to create a global model or pass the data directly to the other view (i'm new to SAPUI5). Can anybody help me with that please?

Thank you in advance.

  • Does this answer your question? [Passing Data Between Controllers While Navigating](https://stackoverflow.com/questions/48831967/passing-data-between-controllers-while-navigating) – Boghyon Hoffmann Aug 05 '22 at 11:38

1 Answers1

3

Approach 1: Global model

You can create global model in component.js or App.controller.js

enter image description here

and later you can assign data (selected record) to baseModel property like below

this.getView().getModel('baseModel').setProperty('/oSelectedRecord', data)

and in other view you can access that by below

this.getView().getModel('baseModel').getProperty('/oSelectedRecord')

Approach 2: Routing with parameter

Source view changes

enter image description here

Destination view changes

enter image description here

You can check detailed example in walkthough (choose older version, in newer version you won't see much code details)

Prashob Thekkyal
  • 410
  • 1
  • 11
  • 27