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 Jan 17, 2019
1 parent 037c4c7 commit 8687516
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/sap.m/src/sap/m/SelectDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,19 @@ function(
press: function() {
this._removeSelection();
this._updateSelectionIndicator();
this._oDialog.focus();
if (this.getMultiSelect()) {
this._oDialog.focus();
} else {
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)
});
}
Expand Down Expand Up @@ -1064,7 +1076,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 8687516

Please sign in to comment.