Skip to Content
0

SAPUI5 - Set Model of view2 from view1 controller

Jan 05, 2017 at 06:08 PM

59

avatar image

Hi,

I have two views with two tables (a table in each view) - both views are visible at start.

The trigger for the servlet is the "onInit" of view1 controller.

The servlet (which returns two json arrays) sets view1 model.

How do I set view2 model ?

Aviad

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Jun Wu Jan 05, 2017 at 09:44 PM
1

are u using component based development?

if yes, you set the model to component, model will be available to all view

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi,

I do use MVC.

But I didn't understad where to bind the model to each view.

Another option I have is to call the servlet from the component.js and set both models as a sapui core models.

But how do I connect them to the views?

Aviad

0

if you use component, call this.setModel() in the component should be enough. the model will be available to all view if the view are created by routing.

1
A K Jan 09, 2017 at 06:15 AM
0

Use this.byId("ViewID").setModel(<JSON MODEL>) - You can set JSON model to view or table....

Share
10 |10000 characters needed characters left characters exceeded