Skip to content

Commit 8687516

Browse files
committed
sap.m.SelectDialog: Allow clear in single selection
The clear button is always enabled now, if showClearButton=true and multiSelect=false. The clear button behavior is redefined to act as clear+confirm in single selection mode.
1 parent 037c4c7 commit 8687516

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/sap.m/src/sap/m/SelectDialog.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,19 @@ function(
10171017
press: function() {
10181018
this._removeSelection();
10191019
this._updateSelectionIndicator();
1020-
this._oDialog.focus();
1020+
if (this.getMultiSelect()) {
1021+
this._oDialog.focus();
1022+
} else {
1023+
fnClearAfterClose = function () {
1024+
this._oSelectedItem = this._oList.getSelectedItem();
1025+
this._aSelectedItems = this._oList.getSelectedItems();
1026+
1027+
this._oDialog.detachAfterClose(fnClearAfterClose);
1028+
this._fireConfirmAndUpdateSelection();
1029+
}.bind(this);
1030+
this._oDialog.attachAfterClose(fnClearAfterClose);
1031+
this._oDialog.close();
1032+
}
10211033
}.bind(this)
10221034
});
10231035
}
@@ -1064,7 +1076,7 @@ function(
10641076
oInfoBar = this._oList.getInfoToolbar();
10651077

10661078
if (this.getShowClearButton() && this._oClearButton) {
1067-
this._oClearButton.setEnabled(iSelectedContexts > 0);
1079+
this._oClearButton.setEnabled(iSelectedContexts > 0 || !this.getMultiSelect());
10681080
}
10691081
// update the selection label
10701082
oInfoBar.setVisible(!!iSelectedContexts && this.getMultiSelect());

0 commit comments

Comments
 (0)