From fe00db62d6880e237225b13e89c0ca7de4f2472f Mon Sep 17 00:00:00 2001 From: John Anderson Date: Thu, 31 Jan 2019 13:56:36 -0500 Subject: [PATCH] fixes #2837 - select2 nullable filter fields add multiple null_option elements when paging --- CHANGELOG.md | 1 + netbox/project-static/js/forms.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59c90565b..f8f30c4b1 100644 --- a/CHANGELOG.md +++ b/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 --- diff --git a/netbox/project-static/js/forms.js b/netbox/project-static/js/forms.js index 235705763..438882805 100644 --- a/netbox/project-static/js/forms.js +++ b/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,