mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Set focus on the first enabled field when a dialogue is opened. Fixes #1533
This commit is contained in:
parent
01bfa88309
commit
c9b717ed68
@ -294,6 +294,12 @@ define([
|
||||
});
|
||||
}
|
||||
|
||||
var setFocusOnEl = function() {
|
||||
setTimeout(function() {
|
||||
$(el).find('.tab-pane.active:first').find('input:first').focus();
|
||||
}, 500);
|
||||
};
|
||||
|
||||
if (!newModel.isNew()) {
|
||||
// This is definetely not in create mode
|
||||
var msgDiv = '<div class="alert alert-info pg-panel-message pg-panel-properties-message">'+
|
||||
@ -306,6 +312,7 @@ define([
|
||||
$msgDiv.appendTo(ctx);
|
||||
}
|
||||
}, 1000, ctx);
|
||||
|
||||
newModel.fetch()
|
||||
.success(function(res, msg, xhr) {
|
||||
// clear timeout and remove message
|
||||
@ -315,9 +322,7 @@ define([
|
||||
// We got the latest attributes of the
|
||||
// object. Render the view now.
|
||||
view.render();
|
||||
if (type != 'properties') {
|
||||
$(el).focus();
|
||||
}
|
||||
setFocusOnEl();
|
||||
newModel.startNewSession();
|
||||
})
|
||||
.error(function(xhr, error, message) {
|
||||
@ -351,8 +356,9 @@ define([
|
||||
});
|
||||
} else {
|
||||
// Yay - render the view now!
|
||||
$(el).focus();
|
||||
// $(el).focus();
|
||||
view.render();
|
||||
setFocusOnEl();
|
||||
newModel.startNewSession();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user