mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #884: Preserve selected rack unit when changing a device's rack face
This commit is contained in:
@ -73,6 +73,7 @@ $(document).ready(function() {
|
|||||||
// Resolve child field by ID specified in parent
|
// Resolve child field by ID specified in parent
|
||||||
var child_name = $(this).attr('filter-for');
|
var child_name = $(this).attr('filter-for');
|
||||||
var child_field = $('#id_' + child_name);
|
var child_field = $('#id_' + child_name);
|
||||||
|
var child_selected = child_field.val();
|
||||||
|
|
||||||
// Wipe out any existing options within the child field
|
// Wipe out any existing options within the child field
|
||||||
child_field.empty();
|
child_field.empty();
|
||||||
@ -106,7 +107,9 @@ $(document).ready(function() {
|
|||||||
$.each(response, function (index, choice) {
|
$.each(response, function (index, choice) {
|
||||||
var option = $("<option></option>").attr("value", choice.id).text(choice[display_field]);
|
var option = $("<option></option>").attr("value", choice.id).text(choice[display_field]);
|
||||||
if (disabled_indicator && choice[disabled_indicator] && choice.id != initial_value) {
|
if (disabled_indicator && choice[disabled_indicator] && choice.id != initial_value) {
|
||||||
option.attr("disabled", "disabled")
|
option.attr("disabled", "disabled");
|
||||||
|
} else if (choice.id == child_selected) {
|
||||||
|
option.attr("selected", "selected");
|
||||||
}
|
}
|
||||||
child_field.append(option);
|
child_field.append(option);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user