Skip to content

Commit

Permalink
sap.m.SelectDialog: Allow clear in single selection
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zypA13510 committed Aug 10, 2019
1 parent ccdea50 commit 33416fc
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/sap.m/src/sap/m/SelectDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,20 @@ function(
if (!this._oClearButton) {
this._oClearButton = new Button(this.getId() + "-clear", {
text: this._oRb.getText("SELECTDIALOG_CLEARBUTTON"),
press: this.clearSelection.bind(this)
press: function() {
this.clearSelection();
if (!this.getMultiSelect()) {
fnClearAfterClose = function () {
this._oSelectedItem = this._oList.getSelectedItem();
this._aSelectedItems = this._oList.getSelectedItems();

this._oDialog.detachAfterClose(fnClearAfterClose);
this._fireConfirmAndUpdateSelection();
}.bind(this);
this._oDialog.attachAfterClose(fnClearAfterClose);
this._oDialog.close();
}
}.bind(this)
});
}
return this._oClearButton;
Expand Down Expand Up @@ -1098,7 +1111,7 @@ function(
oInfoBar = this._oList.getInfoToolbar();

if (this.getShowClearButton() && this._oClearButton) {
this._oClearButton.setEnabled(iSelectedContexts > 0);
this._oClearButton.setEnabled(iSelectedContexts > 0 || !this.getMultiSelect());
}
// update the selection label
oInfoBar.setVisible(!!iSelectedContexts && this.getMultiSelect());
Expand Down

0 comments on commit 33416fc

Please sign in to comment.