简体   繁体   English

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

[英]"Select all/Deselect all" in SAPUI5 SelectDialog

I have a SAPUI5 SelectDialog.我有一个 SAPUI5 SelectDialog。 It contains multiple entries.它包含多个条目。 Right now, UI5 provides property to clear all the selected values using showClearButton="true"现在,UI5 提供了使用showClearButton="true"清除所有选定值的属性在此处输入图片说明

What I want to achieve?我想达到什么目标? I want to implement similar functionality, to "Select all" entries in the dialog.我想实现类似的功能,在对话框中“选择所有”条目。 I know sap.m.tableSelectDialog provides this, but how can I do this in SelectDialog?我知道 sap.m.tableSelectDialog 提供了这个,但我如何在 SelectDialog 中做到这一点? Possible solutions can include可能的解决方案包括

  1. Check box at top, which says "Select/Deselect all"顶部的复选框,上面写着“全选/取消全选”
  2. Button in footer of SelectDialog, which says "Select/Deselect all". SelectDialog页脚中的按钮,显示“全选/取消全选”。 在此处输入图片说明

Any suggestions are welcomed.欢迎任何建议。

The SelectDialog's use case is one way binding. SelectDialog 的用例是一种方式绑定。 This means you supply in a list of items and, using the Dialog in the appropriate mode, its function will be to provide you with what was selected (ie not for you to manipulate the values of the checkboxes)这意味着您提供一个项目列表,并在适当的模式下使用 Dialog,它的功能是为您提供选择的内容(即不是让您操作复选框的值)

Why not use a List within a Dialog (and not a SelectDialog) if you want to achieve this?如果要实现这一点,为什么不在对话框(而不是 SelectDialog)中使用列表? There is a List Item type if you bind this appropriately如果您适当地绑定它,则有一个 List Item 类型

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

that may be of value to you for this purpose?为此目的,这可能对您有价值?

From the documentation :文档

List structure & selection The search field triggers the events search and liveChange where a filter function can be applied to the list binding.列表结构和选择 搜索字段触发事件搜索和 liveChange,其中过滤器功能可以应用于列表绑定。 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.列表不断增长的功能不支持双向绑定,因此如果您将此控件与 JSON 模型一起使用,请确保将绑定模式设置为 OneWay,并使用在确认事件中传递的项目手动更新选择模型。 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.您可以将 rememberSelections 设置为 true 以存储当前选择并在再次打开对话框时加载此状态。 When cancelling the selection, the event change will be fired and the selection is restored to the state when the dialog was opened.取消选择时,将触发事件更改,并将选择恢复到打开对话框时的状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM