sapui5 - 如何将多个复选框与其标签放在一行中?
问题描述
我想用智能字段设计类似下图的东西:
当我尝试使用以下代码设计它时:
<smartForm:GroupElement>
<smartField:SmartField value="{Vermieter}"/>
<smartField:SmartField value="{HIT}" textLabel="HIT"/>
<smartField:SmartField value="{Konzessionär}" textLabel="Konzessionär"/>
</smartForm:GroupElement>
我收到的是以下结果:
首先,标签丢失。
其次,这个位置并不完全正确。第二项和第三项之间的距离与我们在第一项和第二项之间的距离不同。
有什么建议吗?
更新
感谢@MrNajzs的评论,我取得了以下进展:
<smartForm:GroupElement>
<smartField:SmartLabel labelFor="Vermieter"/>
<smartField:SmartField value="{Vermieter}" id="Vermieter"/>
<smartField:SmartLabel labelFor="HIT"/>
<smartField:SmartField value="{HIT}" id="HIT"/>
<smartField:SmartLabel labelFor="Konzessionaer"/>
<smartField:SmartField value="{Konzessionär}" id="Konzessionaer"/>
</smartForm:GroupElement>
但仍然存在一些问题。元素仍未调整。这是输出:
解决方案
这是答案。我必须为每个元素使用不同的Group
并使用GridData
布局。
<smartForm:SmartForm flexEnabled="false">
<smartForm:Group >
<smartForm:GroupElement>
<smartField:SmartField value="{RstID}" width="auto" contextEditable="true" >
<smartField:configuration>
<smartField:Configuration preventInitialDataFetchInValueHelpDialog="false" displayBehaviour="descriptionOnly"/>
</smartField:configuration>
</smartField:SmartField>
</smartForm:GroupElement>
</smartForm:Group>
</smartForm:SmartForm>
<smartForm:SmartForm flexEnabled="false">
<smartForm:layout>
<smartForm:Layout labelSpanL="9" labelSpanM="9" labelSpanS="12" columnsL="3" columnsM="3" />
</smartForm:layout>
<smartForm:Group>
<smartForm:layoutData>
<l:GridData span="L4 M3 S6" indent="L1 M3"/>
</smartForm:layoutData>
<smartForm:GroupElement>
<smartField:SmartField value="{Vermieter}"/>
</smartForm:GroupElement>
</smartForm:Group>
<smartForm:Group>
<smartForm:layoutData>
<l:GridData span="L3 M3 S6"/>
</smartForm:layoutData>
<smartForm:GroupElement>
<smartField:SmartField value="{HIT}"/>
</smartForm:GroupElement>
</smartForm:Group>
<smartForm:Group>
<smartForm:layoutData>
<l:GridData span="L3 M3 S6"/>
</smartForm:layoutData>
<smartForm:GroupElement>
<smartField:SmartField value="{Konzessionär}"/>
</smartForm:GroupElement>
</smartForm:Group>
</smartForm:SmartForm>
仍然不是一个完美的解决方案,因为可以看出第一行和第二行的空白空间之间存在一些差异,但仍然可以忽略不计!
推荐阅读
- swift - WKWebView 密码自动填充
- html - 悬停时更改 SVG 填充和文本突出显示颜色
- javascript - 创建的按钮没有 onclick
- html - 在我的信息右侧获取图像
- c# - 设置 DataGridView 的 DataSource 时索引超出范围异常
- c# - 如何在 Visual Studio WPF 上创建这种模型?[TreeList to TextBox]
- strapi - Strapi 删除与条目相关的文件
- python - 如何在 Django 中重定向到同一页面?
- android - 如何使用 Android 中的 WorkManager 将数据从一个周期性工作事件传递到下一个工作事件?
- python - 我想在 python 中使用 asycnio 在输入时打印一些东西