SAPUI5:如何在XML视图中显示嵌套项目

时间:2020-04-23 10:44:26

标签: javascript xml view datatable sapui5

如标题所述,我确实有以下Table

<Table>
  <columns>
    <Column text="Name" width="200px" />
    <Column text="Options" width="200px" />
  </columns>
  <ColumnListItem>
    <cells> 

    </cells>
  </ColumnListItem>
</Table>

使用以下Model

var exampleModel ="{
   "Model" =[
      0:{
         "name":"FirstName",
         "options":["0","1","2","3","4","5","6","7","8","9","10"]
      },
      1:{
         "name":"SecondName",
         "options":["0","1","2","3","4","5","6","7","8","9","10"]
      },
      2:{
         "name":"ThirdName",
         "options":["0","1","2","3","4","5","6","7","8","9","10"]
      },
      3:{
         "name":"FourthName",
         "options":["0","1","2","3","4","5","6","7","8","9","10"]
      }
   ]
}

this.setData(exampleModel.Model); // for "exampleModel" bellow.

我知道如何遍历“模型”并显示所有名称:

<Label text="{exampleModel>name }"/>

无论如何显示所有10个选项,我都需要制作一个-容器并访问所有10个按钮:

<items>
  <SegmentedButtonItem text="{exampleModel>options/0}"/>
  <SegmentedButtonItem text="{exampleModel>options/1}"/>    
  <SegmentedButtonItem text="{exampleModel>options/2}"/>
  <SegmentedButtonItem text="{exampleModel>options/3}"/>
  //.....etc till <SegmentedButtonItem text="{exampleModel>options/10}"/>
</items>

问题:是否可以使用两个循环,从而允许显示所有10个按钮而不是直接访问?

外观如何Table Displayed

0 个答案:

没有答案