如何换行以自动调整行高?
How to wrap texts to auto-adjust row height?
我确实有一个 sap.m.Table
如下所示:
<Table id="idTable" growing="true" mode="SingleSelectMaster" items="{modelExample>/}">
<columns>
<Column width="20%">
<Text text="Category" />
</Column>
<Column width="20%">
<Text text="Description"/>
</Column>
<Column width="30%">
<Text text="Choice"/>
</Column>
</columns>
<ColumnListItem>
<Label text="{modelExample>category}" design="Bold"/>
<Label text="{modelExample>description}" />
<l:HorizontalLayout>
<Button text="{modelExample>choice/0}" />
<Button text="{modelExample>choice/1}" />
</l:HorizontalLayout>
</ColumnListItem>
</Table>
此 Table
产生以下结果:
问题:描述栏中的文字确实比显示的多很多,表示为"...".
问题:如何更改行高使其自动适应文本内容的数量?
我想要的:
sap.m.Label
从 UI5 1.50 开始支持换行。
<Label text="{myText}" wrapping="true" />
但是:如果应用程序应与 Fiori UX 保持一致,则应使用 Label
仅当它标记某些东西时(例如,结合 labelFor
关联)。如果不是,则应使用不同的文本控件。来自 https://experience.sap.com/fiori-design-web/label/:
- Do not use the label control to display the data
- Do not use bold labels.
另一个控件 sap.m.Text
也有 wrapping
属性,默认情况下启用。如果文本需要加粗,请尝试 sap.m.FormattedText
和 htmlText="<strong>{myText}</strong>
*.
* 要允许复杂的绑定语法,请将 "edge"
分配给 index.html
中的 data-sap-ui-compatversion
。
我确实有一个 sap.m.Table
如下所示:
<Table id="idTable" growing="true" mode="SingleSelectMaster" items="{modelExample>/}">
<columns>
<Column width="20%">
<Text text="Category" />
</Column>
<Column width="20%">
<Text text="Description"/>
</Column>
<Column width="30%">
<Text text="Choice"/>
</Column>
</columns>
<ColumnListItem>
<Label text="{modelExample>category}" design="Bold"/>
<Label text="{modelExample>description}" />
<l:HorizontalLayout>
<Button text="{modelExample>choice/0}" />
<Button text="{modelExample>choice/1}" />
</l:HorizontalLayout>
</ColumnListItem>
</Table>
此 Table
产生以下结果:
问题:描述栏中的文字确实比显示的多很多,表示为"...".
问题:如何更改行高使其自动适应文本内容的数量?
我想要的:
sap.m.Label
从 UI5 1.50 开始支持换行。
<Label text="{myText}" wrapping="true" />
但是:如果应用程序应与 Fiori UX 保持一致,则应使用 Label
仅当它标记某些东西时(例如,结合 labelFor
关联)。如果不是,则应使用不同的文本控件。来自 https://experience.sap.com/fiori-design-web/label/:
- Do not use the label control to display the data
- Do not use bold labels.
另一个控件 sap.m.Text
也有 wrapping
属性,默认情况下启用。如果文本需要加粗,请尝试 sap.m.FormattedText
和 htmlText="<strong>{myText}</strong>
*.
* 要允许复杂的绑定语法,请将 "edge"
分配给 index.html
中的 data-sap-ui-compatversion
。