gpt4 book ai didi

sapui5 - 聚合绑定(bind)信息中 `key`的用途

转载 作者:行者123 更新时间:2023-12-05 07:39:22 27 4
gpt4 key购买 nike

bindAggregation的API引用解释了绑定(bind)信息属性 key 对于改进模型中的更新行为很有用。

The name of the key property. [...] This can be used to improve update behaviour in models, where a key is not already available.

但是,该解释有些不完整,这让我想知道在哪些情况下提供关键属性实际上很有用。

当然,我可以为每个聚合绑定(bind)定义提供 key ,但我在做某事时并不知道“为什么”。另一方面,上面的引述也隐含地告诉我, key 已经可用的情况。于是浏览了下源码,发现ODataListBinding(V2)有getEntryKey它以 key 值的形式提供每个绑定(bind)路径。但是,在我的项目中没有调用该方法。

由于提供的 key,有没有人经历过“模型中的更新行为”的任何重大改进?


我知道 this case其中一个键有助于将双向数据绑定(bind)与启用 growing 的控件相结合(尽管文档说它是 not allowed to combine them together )。但我认为这不是 key 的实际用例。

最佳答案

文档主题 Extended Change Detection (ECD) 部分“在应用程序开发中使用扩展变更检测”回答了大部分问题:

If a control [..] supports extended change detection, you should make sure that each entity of your model has a unique key to improve performance.

  • For OData models, the unique keys are automatically provided.
  • For all other models (like a JSON model), you have to define the keys either by using a key property [name] or by using a function that calculates the key in the binding info of their list binding [...].

每当列表/表数据集合发生变化时,ECD 允许跳过整个条目(例如 sap.m.ListItems)的销毁,但只更新部分。为此,如文档中所述,非 OData 模型需要聚合绑定(bind)中的有效 key 属性。

关于sapui5 - 聚合绑定(bind)信息中 `key`的用途,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47142793/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com