Skip to content

Commit f3f1a5f

Browse files
committed
🚑 fix bug with duplicating example dropdown after saving changes
1 parent 24190f0 commit f3f1a5f

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

js/details/modal/dropdown-page.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
} from "../details-functions.js";
77
import { createTextField, createDropdown } from "../widgets/widgets-base.js";
88
import { createMainPage } from "./main-page.js";
9-
import { select2Dropdown } from "../widgets/widgets-special.js";
109

1110
function createDropdownPage(id, data) {
1211
d3.select(id)

js/details/modal/main-page.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { createTextFieldPage } from "./text-field-page.js";
1313
import { createRadioButtonsPage } from "./radio-buttons-page.js";
1414
import { createDropdownPage } from "./dropdown-page.js";
1515
import { createTimeWidgetPage } from "./time-widget-page.js";
16+
import { createWidgetTypePage } from "./widget-type-page.js";
1617

1718
function createMainPage(id) {
1819
d3.select(id)
@@ -275,6 +276,7 @@ function saveChanges(e) {
275276
var visibleDetails = titles.map(x =>
276277
_.find(getDetails(), { title: x.title })
277278
);
279+
createWidgetTypePage();
278280
createDetailsPanel(visibleDetails);
279281
shotTypeLegend();
280282
teamLegend();

js/details/modal/widget-type-page.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { changePage } from "../details-functions.js";
22
import { createTimeWidget } from "../widgets/widgets-base.js";
33
function createWidgetTypePage(id = "#widget-type-page") {
4+
d3.select(id)
5+
.selectAll("*")
6+
.remove();
47
var mb = d3
58
.select(id)
69
.append("div")

js/details/widgets/widgets-special.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,6 @@ function teamRadioButtons(id, data) {
8383
function select2Dropdown() {
8484
$(".select2").select2({});
8585

86-
$("#example-select").select2({
87-
dropdownParent: $(".cards"),
88-
width: "100%",
89-
dropdownCssClass: "small-text",
90-
});
91-
9286
$("#sample-dropdown-select").select2({
9387
dropdownParent: $("#sample-dropdown"),
9488
width: "100%",
@@ -109,6 +103,11 @@ function select2Dropdown() {
109103
.find("option")
110104
.removeAttr("data-select2-tag");
111105
});
106+
$("#example-select").select2({
107+
dropdownParent: $(".cards"),
108+
width: "100%",
109+
dropdownCssClass: "small-text",
110+
});
112111
}
113112

114113
export { createTooltip, teamRadioButtons, select2Dropdown };

0 commit comments

Comments
 (0)