cancel
Showing results for 
Search instead for 
Did you mean: 

table items bound via association/navigation property not updated after model has changed

TobiasMeinzer
Advisor
Advisor
0 Kudos

Hi Community,

I built a SAPUI5 application with an IconTabBar. One of the use cases is to make changes in Tab1 and then reviewing those changes in an application log shown in Tab2.

The application log is visualized with a sap.m.table. The view in Tab2 is bound to the same context as Tab1, the table inside this view binds its items via a navigation property.

When showing the Tab2 for the first time all application log data is loaded properly and displayed in the table. If I do changes afterwards on Tab1 and want to review them on Tab2 these changes are not displayed. I have to refresh the whole application via browser refresh in order to get the latest changes stored in the log in backend.

Why does the table in Tab2 not get refreshed when model data has changed? It seems the problem is due to binding with navigation property / association which gets not updated on model changes...

following some code snippets.

view binding in the view controller:

_onObjectMatched: function(oEvent) {
  var sObjectId = oEvent.getParameter("arguments").objectId;
  var sVersionId = oEvent.getParameter("arguments").versionId;
  var sLanguage = oEvent.getParameter("arguments").language;
  this.getModel().metadataLoaded().then(function() {
   var sObjectPath = this.getModel().createKey("TestCaseHeaderSet", {
					Case_ID: sObjectId,
					Case_Version: sVersionId,
					Language: sLanguage
				});
				this._bindView("/" + sObjectPath);
			}.bind(this));
},

items binding of the table in the XML view:

<Table id="changeLogTable" noDataText="{i18n>noChangeLogEntriesFound}" items="{ path: 'TestCaseHeadertoChangeDocNav' }" growing="true" growingThreshold="20">

Any thoughts?

Many thanks

Tobias

Accepted Solutions (1)

Accepted Solutions (1)

TobiasMeinzer
Advisor
Advisor

I do a refresh on the elementbinding of the log view now after data is saved, this helps. I did not want to refresh the entire model again, since only the element binding of this specific view needs to be updated. now it works as expected.

viewName.getElementBinding().refresh(true);

Answers (1)

Answers (1)

former_member227918
Active Contributor
0 Kudos

you can check two points,

1) model should have "twoway" binding mode

2) after update changes do, model.refresh()