Bug fixes:

- prevent addition of empty filter tags
This commit is contained in:
Oliver Walters 2020-04-11 22:09:09 +10:00
parent 57d7d729c1
commit d606df16f7
3 changed files with 11 additions and 7 deletions

View File

@ -16,6 +16,7 @@ function defaultFilters() {
return { return {
stock: "cascade=1", stock: "cascade=1",
build: "", build: "",
parts: "cascade=1",
}; };
} }
@ -308,12 +309,15 @@ function setupFilterList(tableKey, table, target) {
var tag = element.find(`#filter-tag-${tableKey}`).val(); var tag = element.find(`#filter-tag-${tableKey}`).val();
var val = element.find(`#filter-value-${tableKey}`).val(); var val = element.find(`#filter-value-${tableKey}`).val();
var filters = addTableFilter(tableKey, tag, val); // Only add the new filter if it is not empty!
if (tag && tag.length > 0) {
var filters = addTableFilter(tableKey, tag, val);
reloadTable(table, filters);
reloadTable(table, filters); // Run this function again
setupFilterList(tableKey, table, target);
}
// Run this function again
setupFilterList(tableKey, table, target);
}); });
} else { } else {
addClicked = false; addClicked = false;

View File

@ -106,7 +106,7 @@ function loadPurchaseOrderTable(table, options) {
var params = options.params || {}; var params = options.params || {};
var filters = loadTableFilters("build"); var filters = loadTableFilters("order");
for (var key in params) { for (var key in params) {
filters[key] = params[key]; filters[key] = params[key];

View File

@ -19,8 +19,8 @@ function getAvailableTableFilters(tableKey) {
return { return {
cascade: { cascade: {
type: 'bool', type: 'bool',
description: '{% trans "Include stock in sublocations" %}',
title: '{% trans "Include sublocations" %}', title: '{% trans "Include sublocations" %}',
description: '{% trans "Include stock in sublocations" %}',
}, },
active: { active: {
type: 'bool', type: 'bool',