closes reorder/remove dialog when a click is made outside or when escape key is presses
This commit is contained in:
parent
e3f125dd9f
commit
ad017434dc
@ -67,10 +67,34 @@ ColumnReorderingDialog.prototype._createDialog = function() {
|
|||||||
connectWith: '.column-reordering-dialog-column-container'
|
connectWith: '.column-reordering-dialog-column-container'
|
||||||
})
|
})
|
||||||
.disableSelection();
|
.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() {
|
ColumnReorderingDialog.prototype._dismiss = function() {
|
||||||
DialogSystem.dismissUntil(this._level - 1);
|
DialogSystem.dismissUntil(this._level - 1);
|
||||||
|
$(document).off('click');
|
||||||
|
$(window).off('keydown');
|
||||||
};
|
};
|
||||||
|
|
||||||
ColumnReorderingDialog.prototype._commit = function() {
|
ColumnReorderingDialog.prototype._commit = function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user