sap.m.ObjectListItem:需要在标题中保留空格(制表符)

时间:2019-03-12 04:31:32

标签: sapui5

<ObjectListItem
  title="{i18n>uBOMItem}: {Item}         Component: {ComponentDesc}"
  number="{ComponentNo}"
>

我正在使用sap.m.ObjectListItem。绑定时,我需要在{Item}{ComponentDesc}之间使用制表符空间。

例如像\t

2 个答案:

答案 0 :(得分:1)

当前,sap.m.ObjectListItem 不支持呈现标题的空白。 而且我同意alexP's answer的观点,将多个标签("{i18n>uBOMItem}:""Component:")组合成一个标签并不干净。
话虽如此; 如果确实需要这样做,则需要扩展ObjectListItem。

示例:https://embed.plnkr.co/WaMaP4wqMevsjMxX

  

enter image description here

在内部,ObjectListItem从sap.m.Text呈现其标题。 Text控件具有一个名为renderWhiteSpace api 的公共属性,我们可以使用该属性来允许显示选项卡。

答案 1 :(得分:0)

ObjectListItem仅用于一个值。在您的情况下,最好使用CustomListItem

<CustomListItem>
  <HBox width="100%">
    <VBox>
      <Label emphasized="true" text="{i18n>uBOMItem}: {Item}" />
    </VBox>
    <VBox class="sapUiSmallMarginBegin">
      <Label emphasized="true" text="Component: {ComponentDesc}" />
    </VBox>
    <VBox width="50%" justifyContent="End">
      <ObjectNumber number="{ComponentNo}" />
    </VBox>
  </HBox>
</CustomListItem>

从模型中以一个标签,文本或类似形式输出两个数据绑定并不干净。您应该分割输出。如果在一个控件中使用i18n标签和数据绑定,我会例外。