From 1c39a630eb27dfefb8e57aa8866bec99438898a0 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 9 Sep 2024 14:04:18 -0600 Subject: [PATCH 1/2] Fix row in formset event --- smart_selects/static/smart-selects/admin/js/bindfields.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smart_selects/static/smart-selects/admin/js/bindfields.js b/smart_selects/static/smart-selects/admin/js/bindfields.js index 295d563..989b07b 100755 --- a/smart_selects/static/smart-selects/admin/js/bindfields.js +++ b/smart_selects/static/smart-selects/admin/js/bindfields.js @@ -61,10 +61,11 @@ initItem(chained); } - $(document).on('formset:added', function (event, $row, formsetName) { + $(document).on('formset:added', function (event) { // Fired every time a new inline formset is created var chainedFK, chainedM2M, filteredM2M; + var $row = $(event.target); // For the ForeingKey chainedFK = $row.find(".chained-fk"); From 16193ab99d0c6c138b61a9376a976f43c9d3369a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 29 Oct 2024 08:20:16 -0600 Subject: [PATCH 2/2] Update smart_selects/static/smart-selects/admin/js/bindfields.js Co-authored-by: Pablo Androetto --- smart_selects/static/smart-selects/admin/js/bindfields.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smart_selects/static/smart-selects/admin/js/bindfields.js b/smart_selects/static/smart-selects/admin/js/bindfields.js index 989b07b..99d5f81 100755 --- a/smart_selects/static/smart-selects/admin/js/bindfields.js +++ b/smart_selects/static/smart-selects/admin/js/bindfields.js @@ -61,11 +61,11 @@ initItem(chained); } - $(document).on('formset:added', function (event) { + $(document).on('formset:added', function (event, _row) { // Fired every time a new inline formset is created var chainedFK, chainedM2M, filteredM2M; - var $row = $(event.target); + var $row = _row || $(event.target); // For the ForeingKey chainedFK = $row.find(".chained-fk");