Refresh model SAPUI5

2019-05-13 19:58发布

I'm developing SAP Fiori app with master detail template. i'm having troubles,I need to update a particular data every 5 seconds, but i don't want to refresh the entire model because it takes too long to render.

Any idea how to do that?

4条回答
萌系小妹纸
2楼-- · 2019-05-13 20:24

You could try to refresh the Binding on your control. For example:

sap.ui.getCore().byId("myList").getBinding("items").refresh();

Depending on the type of Model you are using this would send a more focused request.

查看更多
孤傲高冷的网名
3楼-- · 2019-05-13 20:32

You could try to refresh the element binding of the view or control.

this.getView().getElementBinding().refresh(true);
查看更多
爷的心禁止访问
4楼-- · 2019-05-13 20:32

You could do the following. Set a modelDetail for your detail, and a modelMaster for your master. Put the same data in both models when you initialize your app.

When you want to update part of your data in a specific model, use

modelDetail .setProperty(yourPath, yourNewProperty);

this will automatically update all bindings for the changed properties, only in the detail view.

查看更多
smile是对你的礼貌
5楼-- · 2019-05-13 20:38

You should use two way binding. https://sapui5.netweaver.ondemand.com/#docs/guide/c72b922fdb59422496661000165d7ff1.html

Then if you have an oData model you can set the property refresh to 5. This will refresh the oData-Model every 5 seconds. Than the two way binding will update the specific parts of your view, without having to refresh the entire view.

查看更多
登录 后发表回答