cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 bindElement not refreshs main Model

Former Member

Hello,

i try to create a Master/Detail View with oData v4.

The Problem is that when i edit a element on a the detailview (for Example the Name). The list on MasterView is not refreshed.

So ein bind it on my Masterview:

<List items="{som>/Users}" >    
<StandardListItemtype="Navigation"title="{som>UserName}"description="{som>FirstName} {som>LastName}"press="onItemPress" />
</List>

"som" is the Root-Point for my Odata service.

So i do the binding on my Detailview.

this.getView().bindElement({    
path : this.getBindPath(sId),
model: "som"
});


<fLayout:SimpleForm> <fLayout:content> <Label text="{i18n>settings.user.username}" /> <Input value="{som>UserName}" /> </fLayout:content> </fLayout:SimpleForm>

By this i can refresh the list in Masterview:

this.getView().getModel("som").refresh();

But i have to do int manually. How can i attach this to an on change event?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member553417
Participant
0 Kudos

hi florian,

After editing the name in detail .you are calling the master list odata service right?.instead of binding this.getView().getModel("som").refresh();.try to call the master list id and set the model directly to that elementid

sap.ui.getCore().byId("Listid").setModel(Modelname,"som");

Regards,

Drushya

Former Member
0 Kudos

Thanks for your answer!

The problem isn't that the masterview istn't refreshing. That is working with: this.getView().getModel("som").refresh();

But how can i trigger this automatically after an change is happen?

former_member186852
Contributor
0 Kudos

I Think you can use event bus to achieve the same.

former_member553417
Participant
0 Kudos

You are asking which event to use while editing name in detail page? for input change you can use liveChange event.

same master refresh can be called inside

Former Member
0 Kudos

Yes i allready tryied this.

But wehen i use the event "change" an do the refresh there i will get the follwoing error:


"cannot refresh due to pending changes"

I think this is, becauseof my update request isn't finished until that.