mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Merge pull request #2154 from SchrodingersGat/filter-bug-fix
Fix table filtering bug
This commit is contained in:
		| @@ -283,12 +283,16 @@ function setupFilterList(tableKey, table, target) { | |||||||
|  |  | ||||||
|     element.append(`<button id='reload-${tableKey}' title='{% trans "Reload data" %}' class='btn btn-default filter-tag'><span class='fas fa-redo-alt'></span></button>`); |     element.append(`<button id='reload-${tableKey}' title='{% trans "Reload data" %}' class='btn btn-default filter-tag'><span class='fas fa-redo-alt'></span></button>`); | ||||||
|  |  | ||||||
|     // If there are available filters, add them in! |     // If there are no filters defined for this table, exit now | ||||||
|     if (filters.length > 0) { |     if (jQuery.isEmptyObject(getAvailableTableFilters(tableKey))) { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     // If there are filters currently "in use", add them in! | ||||||
|     element.append(`<button id='${add}' title='{% trans "Add new filter" %}' class='btn btn-default filter-tag'><span class='fas fa-filter'></span></button>`); |     element.append(`<button id='${add}' title='{% trans "Add new filter" %}' class='btn btn-default filter-tag'><span class='fas fa-filter'></span></button>`); | ||||||
|  |  | ||||||
|     if (Object.keys(filters).length > 0) { |     if (Object.keys(filters).length > 0) { | ||||||
|             element.append(`<button id='${clear}' title='{% trans "Clear all filters" %}' class='btn btn-default filter-tag'><span class='fas fa-trash-alt'></span></button>`); |         element.append(`<button id='${clear}' title='{% trans "Clear all filters" %}' class='btn btn-default filter-tag'><span class='fas fa-backspace icon-red'></span></button>`); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     for (var key in filters) { |     for (var key in filters) { | ||||||
| @@ -298,7 +302,6 @@ function setupFilterList(tableKey, table, target) { | |||||||
|  |  | ||||||
|         element.append(`<div title='${description}' class='filter-tag'>${title} = ${value}<span ${tag}='${key}' class='close'>x</span></div>`); |         element.append(`<div title='${description}' class='filter-tag'>${title} = ${value}<span ${tag}='${key}' class='close'>x</span></div>`); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // Callback for reloading the table |     // Callback for reloading the table | ||||||
|     element.find(`#reload-${tableKey}`).click(function() { |     element.find(`#reload-${tableKey}`).click(function() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user