Set focus on the first enabled field when a dialogue is opened. Fixes #1533
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()) {
|
if (!newModel.isNew()) {
|
||||||
// This is definetely not in create mode
|
// This is definetely not in create mode
|
||||||
var msgDiv = '<div class="alert alert-info pg-panel-message pg-panel-properties-message">'+
|
var msgDiv = '<div class="alert alert-info pg-panel-message pg-panel-properties-message">'+
|
||||||
|
@ -306,6 +312,7 @@ define([
|
||||||
$msgDiv.appendTo(ctx);
|
$msgDiv.appendTo(ctx);
|
||||||
}
|
}
|
||||||
}, 1000, ctx);
|
}, 1000, ctx);
|
||||||
|
|
||||||
newModel.fetch()
|
newModel.fetch()
|
||||||
.success(function(res, msg, xhr) {
|
.success(function(res, msg, xhr) {
|
||||||
// clear timeout and remove message
|
// clear timeout and remove message
|
||||||
|
@ -315,9 +322,7 @@ define([
|
||||||
// We got the latest attributes of the
|
// We got the latest attributes of the
|
||||||
// object. Render the view now.
|
// object. Render the view now.
|
||||||
view.render();
|
view.render();
|
||||||
if (type != 'properties') {
|
setFocusOnEl();
|
||||||
$(el).focus();
|
|
||||||
}
|
|
||||||
newModel.startNewSession();
|
newModel.startNewSession();
|
||||||
})
|
})
|
||||||
.error(function(xhr, error, message) {
|
.error(function(xhr, error, message) {
|
||||||
|
@ -351,8 +356,9 @@ define([
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Yay - render the view now!
|
// Yay - render the view now!
|
||||||
$(el).focus();
|
// $(el).focus();
|
||||||
view.render();
|
view.render();
|
||||||
|
setFocusOnEl();
|
||||||
newModel.startNewSession();
|
newModel.startNewSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue