mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-28 20:17:42 +01:00
Fixed filter form data resetting when adding filter
This commit is contained in:
parent
180547e078
commit
54b95c1c0a
@ -468,7 +468,7 @@
|
|||||||
Highcharts.setOptions(Highcharts.theme);
|
Highcharts.setOptions(Highcharts.theme);
|
||||||
updateGraphs();
|
updateGraphs();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (graphs !== undefined) console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class MultipleChoiceFilter extends Filter {
|
|||||||
<label for="${this.id}">${select}${this.label}:</label>
|
<label for="${this.id}">${select}${this.label}:</label>
|
||||||
<button class="filter-remover btn btn-outline-secondary float-right"
|
<button class="filter-remover btn btn-outline-secondary float-right"
|
||||||
onclick="removeFilter('${this.id}')"><i class="far fa-fw fa-trash-alt"></i></button>
|
onclick="removeFilter('${this.id}')"><i class="far fa-fw fa-trash-alt"></i></button>
|
||||||
<select class="form-control" multiple>`;
|
<select class="form-control" multiple style="margin-bottom: 0.5rem;">`;
|
||||||
|
|
||||||
for (const option of this.options.options) {
|
for (const option of this.options.options) {
|
||||||
html += `<option>${option}</option>`;
|
html += `<option>${option}</option>`;
|
||||||
@ -42,8 +42,8 @@ class MultipleChoiceFilter extends Filter {
|
|||||||
|
|
||||||
toObject() {
|
toObject() {
|
||||||
let selected = [];
|
let selected = [];
|
||||||
for (let option of document.querySelector(`#${this.id} select`).selectedOptions) {
|
for (let option of document.querySelector(`#${this.id} select`).options) {
|
||||||
selected.push(option.text);
|
if (option.selected) selected.push(option.text);
|
||||||
}
|
}
|
||||||
selected = JSON.stringify(selected);
|
selected = JSON.stringify(selected);
|
||||||
|
|
||||||
|
@ -101,7 +101,9 @@ function addFilter(parentSelector, filterIndex) {
|
|||||||
const id = "f" + queryState.filterCount;
|
const id = "f" + queryState.filterCount;
|
||||||
const filter = createFilter(loadedFilters[filterIndex], id);
|
const filter = createFilter(loadedFilters[filterIndex], id);
|
||||||
queryState.filters.push(filter);
|
queryState.filters.push(filter);
|
||||||
document.querySelector(parentSelector).innerHTML += filter.render(queryState.filterCount);
|
const inserting = document.createElement("template");
|
||||||
|
inserting.innerHTML = filter.render(queryState.filterCount);
|
||||||
|
document.querySelector(parentSelector).appendChild(inserting.content);
|
||||||
queryState.filterCount++;
|
queryState.filterCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user