cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 Control refresh after model update

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

irfan_gokak
Contributor

Hi Sarah,

Can you please share your view code?

Former Member
0 Kudos

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:attributes>
                                            <m:ObjectAttribute title="" text="{CandidateJobTitle}" active="false"/>
                                        </m:attributes>
                                        <m:firstStatus>
                                        	<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:firstStatus>
                                        <m:secondStatus>
                                            <m:ObjectStatus text="" icon="{statusIcon}" />
                                        </m:secondStatus>
                                    </m:ObjectListItem>

irfan_gokak
Contributor

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.

this.getView().byId("list").getModel().setProperty("ProductSet('205174360')/photo","1234");

Hope this will help.

Former Member

Thank you Irfan! This will work!

Answers (2)

Answers (2)

Former Member

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}.

SergioG_TX
Active Contributor
0 Kudos

are you assigning the correct property like:

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

?