closes reorder/remove dialog when a click is made outside or when escape key is presses

This commit is contained in:
Lisa Chandra 2020-02-28 01:54:16 +05:30
parent e3f125dd9f
commit ad017434dc

View File

@ -67,10 +67,34 @@ ColumnReorderingDialog.prototype._createDialog = function() {
connectWith: '.column-reordering-dialog-column-container'
})
.disableSelection();
var justOpened = true;
var clickOutside = function(event) {
$target = $(event.target);
var dialog = $('.dialog-frame');
var dist = $target.closest(dialog).length;
if(justOpened) {
justOpened = false;
return;
}
if(dist == 0 && $(dialog).is(':visible') && !justOpened) {
self._dismiss();
}
}
$(document).click(clickOutside);
var escapeKey = function(event) {
if (event.keyCode == 27) {
self._dismiss();
}
}
$(window).keydown(escapeKey);
};
ColumnReorderingDialog.prototype._dismiss = function() {
DialogSystem.dismissUntil(this._level - 1);
$(document).off('click');
$(window).off('keydown');
};
ColumnReorderingDialog.prototype._commit = function() {