我如何在 SAPUI5 的 Xml 视图中编写无限行中继器 [英] How do i write Infinite Row-repeater in an Xml View in SAPUI5

查看:38
本文介绍了我如何在 SAPUI5 的 Xml 视图中编写无限行中继器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 SAPUI5 中显示复杂的 json 数据.

I am trying to display the complex json data in SAPUI5.

这是我的复杂数据:

results:{
         "name" : "sample",
         "child" : [
                    "name" : "sample",
                    "child" : [
                        "name" : "sample",
                        "child" : [
                                    "name" : "sample",
                                    "child" : [

                                     ]
                                  ]
                     ]
                 ]
        }

这里的内在小孩是无限的.这些取决于我的数据.

Here the inner child is infinite. These are depending on my data.

所以我的问题是如何在 xml 视图中显示这种类型的数据.

So here is my question is how do i display this type of data in xml view.

以前我使用行中继器显示此类数据.那里的数据只有 3 个级别.但现在它有无限.那么我如何使用行中继器来显示这种类型的数据.

Previously i displayed this type of data by using the Row repeater. There the data has only 3 levels. But Now it has infinite. So how can i use row repeater for displaying this type of data.

这是我的 3 级行中继器.

Here is a my 3-level Row Repeater.

<c:RowRepeater rows="{path: bindingpath}" id="rowRepeater" >
      <c:RowRepeater rows="{path: bindingpath/somePath}" >
            <c:RowRepeater rows="{path: bindingpath/somePath/anotherpath}">

            </c:RowRepeater>
      </c:RowRepeater>
</c:RowRepeater>

推荐答案

我会创建一个自定义控件(可能基于RowRepeaterPanel、自定义FlexBox 布局),您可以在其中绑定最高级别的聚合

I would create a custom control (maybe based on RowRepeater, Panel, of a custom FlexBox layout) where you bind an aggregation on the highest level

然后自定义控件应该检查​​ Array 类型的特定节点,如果它有 1 个或多个项目,则从该路径递归渲染子元素,等等.

The custom control should then check for a specific node of type Array, and if it has 1 or more items, render the child elements recursively from that path on, etc.

这篇关于我如何在 SAPUI5 的 Xml 视图中编写无限行中继器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆