cancel
Showing results for 
Search instead for 
Did you mean: 

SplitApp just Master refreshes, not Detail: oModel.callFunction, oModel.refresh

Former Member
0 Kudos

Hello,

I have a split app with a list and a detail controller. I click on a list item and the detail opens with:

Master: List item handle


var context = evt.getParameter("listItem").getBindingContext();

this.nav.to("Detail", context);

The nav.to is defined in the App.controller.js - everything is based on DJ Adams Fiori like apps in 10 exercises.

On the detail I have a button with a certain event handler:


oModelMS.callFunction('UpdateWorkStepStatus', 'GET', updateData, null, fnSuccess, fnError)  ;

and the fnSuccess is like:


oModelMS.refresh(true);

But then only the Master updates and not the detail view... How can I trigger that? If I manually click on the list item it shows the updated dataset...

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

In the Component.js I have set it to:


var uri = "http://localhost:32006/JsonOdataService.svc";

var oModelMS = new sap.ui.model.odata.ODataModel(uri);

sap.ui.getCore().setModel(oModelMS, "odata");

oView.setModel(oModel);

and the Objectheader has just:


<firstStatus>

<ObjectStatus

text="{

path: 'Status',

formatter: 'sap.ui.demo.mySMUI.util.Formatter.statusText'

}"

state="{

path: 'Status',

formatter: 'sap.ui.demo.mySMUI.util.Formatter.statusState'

}" />

</firstStatus>

The binding with odata>Status doesn't work...

Here I tried to upload the source-code:

The App.controller.js handles the navigation, and I have a nested list: Master -> SubMaster, on the submaster I click a line-item which navigates to the Detail-view.

Code is very work in progress:

denisenepraunig/smui_msodata · GitHub

former_member182372
Active Contributor
0 Kudos

You use named model - odata, try to use {odata>LOT_ID} instead of {LOT_ID}, eventhough it works with page.setBindingContext(context); 

Former Member
0 Kudos

oView.setModel(oModel);

Then nothing is display, because the view itself in Component.js doesn't have a named model.

former_member182372
Active Contributor
0 Kudos

named model is in core, so it doesnt matter that it is not in model. send me payload of odata service, i will take a look

Former Member
0 Kudos

<entry>

<id>

<title type="text"/>

<updated>

2014-05-20T17:43:28Z

</updated>

<author>

<name/>

</author>

<link rel="edit" title="tabWorkstep_Status" href="tabWorkstep_Status(LOT_ID='CB01-1-1',ORDER=1,SITE_ID='MILANO',SUBORDER=0,WORKCENTER_ID='PLANTSOUTH',WORKPLACE_ID='ASSEMBLE1',WORKSTEP_ID='ASSTORSO')"/>

<category term="DataServicesJSONP.tabWorkstep_Status" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

<content type="application/xml">

<m:properties>
<d:LOT_ID>
CB01-1-1

</d:LOT_ID>

<d:SITE_ID>

MILANO

</d:SITE_ID>

<d:WORKCENTER_ID>

PLANTSOUTH

</d:WORKCENTER_ID>

<d:WORKPLACE_ID>

ASSEMBLE1

</d:WORKPLACE_ID>

<d:WORKSTEP_ID>

ASSTORSO

</d:WORKSTEP_ID>

<d:ORDER m:type="Edm.Int32">

1

</d:ORDER>

<d:SUBORDER m:type="Edm.Int32">

0

</d:SUBORDER>

<d:Status>

In Queue

</d:Status>

<d:Unit_of_Measurement>

PCS

</d:Unit_of_Measurement>

<d:Quantity m:type="Edm.Decimal">

25.000

</d:Quantity>

<d:Open_Quantity m:type="Edm.Decimal">

23.000

</d:Open_Quantity>

<d:Scrap_Quantity m:type="Edm.Decimal">

2.000

</d:Scrap_Quantity>

<d:Mat_ID>

CB01

</d:Mat_ID>

<d:User_ID m:null="true"/>

<d:WORKINSTRUCTION_ID>

CBO01_T

</d:WORKINSTRUCTION_ID>
</m:properties>
</content>

</entry>

former_member182372
Active Contributor
0 Kudos

Beleive or not it updated object header for me

https://imgflip.com/gif/8xuq4

former_member190939
Participant
0 Kudos

var oModelMS = new sap.ui.model.odata.ODataModel(uri);

sap.ui.getCore().setModel(oModelMS, "odata");

oView.setModel(oModel);

You are using oModelMS and oModel, both are different.

Sorry if I am wrong and too late,

Regards,

Seyed Ismail MAC

former_member182372
Active Contributor
0 Kudos

What exactly do you display in detail view? Does it have binding? You pass binding context, as I see in App.controller 'to' method sets binding context to the whole page:

page.setBindingContext(context);

but are controlls on detail view bound to smth?

Former Member
0 Kudos

Yeah, the controls are bound like and the master-detail navigation works.


<ObjectHeader

  title="Lot ID: {LOT_ID}"

  number="{SITE_ID}"

  numberUnit="Workstep: {WORKSTEP_ID}" >

</ObjectHeader>

When I click on the button the detail view doesn't refresh, but the master does... There must be something missing... Hm... A tiny little step...

When - after the button click - I click on another list item and then to the old one again, then the detail view is updated...

Somehow I must say that the view should "refresh" the data... But it is strange, thought because of "binding" it could be done automatically...

Former Member
0 Kudos

Hello Denise,


I assume that your Data is already updated cause you said it refreshes after you click another item.

You can try to manually rerender the Content of your Detail View inside your Detail Controller by calling


oController.getView().rerender();

This should trigger a manual refresh of the whole Detail Page and you should be able to see your updated Content.

I had a similar problem where the Detail View Content was not refreshing after selecting a new item on the Master View.

I don´t know if this is the expected way to do it but this should work.

best regards

Florian

Former Member
0 Kudos

Hello Florian,

it refreshes the view, but it it doesn't refresh the values... Mysterious...

former_member182372
Active Contributor
0 Kudos

Denise, are you using just odata model? no json model somewhere in between?

Former Member
0 Kudos

// button code

var oModelMS = sap.ui.getCore().getModel("odata");

// code in between

oModelMS.callFunction('UpdateWorkStepStatus', 'GET', updateData, null, fnSuccess, fnError)  ;

// fnSuccess:

oModelMS.refresh(true);

The Detail view doesn't use the JSON-model, but I have a global JSON model.

former_member182372
Active Contributor
0 Kudos

that ObjectHeader  - is it bound to JSON model or odata?