1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #3289: Prevent position from being nullified when moving a device to a new rack

This commit is contained in:
Jeremy Stretch
2019-07-30 17:07:58 -04:00
parent a6c41e0be5
commit ea32853ab3
3 changed files with 6 additions and 3 deletions

View File

@ -183,7 +183,7 @@ $(document).ready(function() {
// Additional query params
$.each(element.attributes, function(index, attr){
if (attr.name.includes("data-additional-query-param-")){
var param_name = attr.name.split("data-additional-query-param-")[1]
var param_name = attr.name.split("data-additional-query-param-")[1];
parameters[param_name] = attr.value;
}
});
@ -194,6 +194,8 @@ $(document).ready(function() {
processResults: function (data) {
var element = this.$element[0];
// Clear any disabled options
$(element).children('option').attr('disabled', false);
var results = $.map(data.results, function (obj) {
obj.text = obj[element.getAttribute('display-field')] || obj.name;
obj.id = obj[element.getAttribute('value-field')] || obj.id;
@ -207,7 +209,7 @@ $(document).ready(function() {
// Handle the null option, but only add it once
if (element.getAttribute('data-null-option') && data.previous === null) {
var null_option = $(element).children()[0]
var null_option = $(element).children()[0];
results.unshift({
id: null_option.value,
text: null_option.text