javascript – SAPUI5 SelectDialog中的“全选/取消全选”

我有一个SAPUI5 SelectDialog.它包含多个条目.现在,UI5提供了使用showClearButton =“true”清除所有选定值的属性

《javascript – SAPUI5 SelectDialog中的“全选/取消全选”》

我想要实现什么?
我想实现类似的功能,对话框中的“全选”条目.我知道sap.m.tableSelectDialog提供了这个,但我怎么能在SelectDialog中做到这一点?可能的解决方案包括

>顶部的复选框,显示“选择/取消全选”
> SelectDialog页脚中的按钮,显示“选择/取消全选”. 《javascript – SAPUI5 SelectDialog中的“全选/取消全选”》

欢迎任何建议.

最佳答案 SelectDialog的用例是单向绑定.

这意味着您提供了一个项目列表,并使用适当模式下的对话框,其功能将是为您提供所选内容(即不是您操纵复选框的值)

如果要实现此目的,为什么不在对话框中使用List(而不是SelectDialog)?如果您适当地绑定它,则有一个List Item类型

<InputListItem label="Your Label">
    <CheckBox selected="true" />

为此目的可能对你有价值吗?

documentation

List structure & selection
The search field triggers the events search
and liveChange where a filter function can be applied to the list
binding. The growing functionality of the list does not support
two-way Binding, so if you use this control with a JSON model make
sure the binding mode is set to OneWay and that you update the
selection model manually with the items passed in the confirm event.
In the multi-select mode of the select dialog, checkboxes are provided
for choosing multiple entries. You can set rememberSelections to true
to store the current selection and load this state when the dialog is
opened again. When cancelling the selection, the event change will be
fired and the selection is restored to the state when the dialog was
opened.

点赞