mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix keyboard control of switches in the column grid. Fixes #1394
This commit is contained in:
committed by
Dave Page
parent
a33ee2ae32
commit
879a6bef53
@@ -352,6 +352,7 @@
|
||||
|
||||
enterEditMode: function() {
|
||||
this.$el.addClass('editor');
|
||||
$(this.$el.find('input')).focus();
|
||||
},
|
||||
|
||||
exitEditMode: function() {
|
||||
@@ -372,7 +373,7 @@
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var col = _.defaults(this.column.toJSON(), this.defaults),
|
||||
var self = this, col = _.defaults(this.column.toJSON(), this.defaults),
|
||||
attributes = this.model.toJSON(),
|
||||
attrArr = col.name.split('.'),
|
||||
name = attrArr.shift(),
|
||||
@@ -401,6 +402,32 @@
|
||||
this.defaults.options
|
||||
));
|
||||
|
||||
// Listen for Tab key
|
||||
this.$el.on('keydown', function(e) {
|
||||
var gotoCell;
|
||||
if(e.keyCode == 9) {
|
||||
// go to Next Cell & if Shift is also pressed go to Previous Cell
|
||||
gotoCell = e.shiftKey ? self.$el.prev() : self.$el.next();
|
||||
}
|
||||
|
||||
if(gotoCell) {
|
||||
setTimeout(function() {
|
||||
if(gotoCell.hasClass('editable')) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var command = new Backgrid.Command({
|
||||
key: "Tab", keyCode: 9,
|
||||
which: 9, shiftKey: e.shiftKey
|
||||
});
|
||||
self.model.trigger("backgrid:edited", self.model,
|
||||
self.column, command);
|
||||
gotoCell.focus();
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.delegateEvents();
|
||||
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user