Skip to Content

UI5 Control refresh after model update

Aug 22, 2017 at 01:24 PM


avatar image

We are using an oData model which is bound to the view. After the binding of the UI has taken place we are trying to update the binding of the model by doing: oModel.setProperty(). This change is not reflected in the UI. We have tried refreshing the list items and refreshing the model after the change, but both of these options call the backend (again) which degrades the performance.

I thought an update to the model should automatically update the control but it is not working in this case.

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

3 Answers

Best Answer
Irfan Gokak Aug 22, 2017 at 02:32 PM

Hi Sarah,

Can you please share your view code?

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

Sure - please see below. Also of note is the fact that this property doesn't exist initially, I create it when the user clicks on an item in the master list.

Here is the view with the icon being set to the Photo.

<m:ObjectListItem intro="{CandidateNeedStatusText}" title="{CandidateName}" icon="{Photo}" number="{ path: 'CandidateAvailabilityDate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' } }" numberUnit="Availability Date" numberState="None" type="Navigation" selected="false" showMarkers="false">
                                            <m:ObjectAttribute title="" text="{CandidateJobTitle}" active="false"/>
                                        	<m:ObjectStatus state="Warning"  icon="{path: 'IsCandidateLeadCaseInAnotherNeed', formatter: '.formatter.CandidateLeadCaseOtherNeedIcon'}" tooltip="This Candidate is the Lead Case in another Need.  Please review other Needs this Canidate is being considered for."/>
                                            <m:ObjectStatus text="" icon="{statusIcon}" />


I think like this you should do if you're modifying master list model. Because its binding look like below when you do get model.

So in this case you should use code as below.


Hope this will help.

1.jpg (38.0 kB)

Thank you Irfan! This will work!

Sergio Guerrero Aug 22, 2017 at 01:25 PM

are you assigning the correct property like:

oModel.setProperty('/<property>', propertyValue);


10 |10000 characters needed characters left characters exceeded
Sarah Lottman
Aug 22, 2017 at 01:32 PM

Yes, it looks like this:

oModel.setProperty(aPaths[iIterator] + "/Photo", "sap-icon://person-placeholder");

After that line in the debugger I can check the model oData and the property is there. I have it bound in the view {Photo}.

10 |10000 characters needed characters left characters exceeded