cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 - Set Model of view2 from view1 controller

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor

are u using component based development?

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

Former Member
0 Kudos

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

junwu
Active Contributor

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.

Answers (1)

Answers (1)

karthikarjun
Active Contributor
0 Kudos

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