Просмотр исходного кода

fixes #2837 - select2 nullable filter fields add multiple null_option elements when paging

John Anderson 7 лет назад
Родитель
Сommit
fe00db62d6
2 измененных файлов с 3 добавлено и 2 удалено
  1. 1 0
      CHANGELOG.md
  2. 2 2
      netbox/project-static/js/forms.js

+ 1 - 0
CHANGELOG.md

@@ -11,6 +11,7 @@ v2.5.5 (FUTURE)
 * [#2824](https://github.com/digitalocean/netbox/issues/2824) - Fix template exception when viewing rack elevations list
 * [#2833](https://github.com/digitalocean/netbox/issues/2833) - Fix form widget for front port template creation
 * [#2835](https://github.com/digitalocean/netbox/issues/2835) - Fix certain model filters did not support the `q` query param
+* [#2837](https://github.com/digitalocean/netbox/issues/2837) - Fix select2 nullable filter fields add multiple null_option elements when paging
 
 ---
 

+ 2 - 2
netbox/project-static/js/forms.js

@@ -197,8 +197,8 @@ $(document).ready(function() {
                     return obj;
                 });
 
-                // Handle the null option
-                if (element.getAttribute('data-null-option')) {
+                // Handle the null option, but only add it once
+                if (element.getAttribute('data-null-option') && data.previous === null) {
                     var null_option = $(element).children()[0]
                     results.unshift({
                         id: null_option.value,