2
votes

I'm using JSONModel as the data model in my SAPUI5 application. I know I could use controlA.getModel().refresh() to refresh the model in control A, but how can I refresh all the models binding in current application?

In my case I have a List A, and the list item of it is CustomListItem which has List B as aggregation. When I delete the first item in A and refresh the model of A, it looks well because the old second item becomes the first. But the in its List B, the binding path is still /A/1/.... but not becomes /A/0. How can I refresh the models in all controls?

1

1 Answers

4
votes

You can pass a boolean to the refresh method. A true indicates that all bindings which are referring to this model shall be refreshed.

If your controls are bound to different models you need call refresh on each model instance, but instead of obtaining the model via each control you can use:

this.getView().getModel()