mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Merge pull request #2154 from SchrodingersGat/filter-bug-fix
Fix table filtering bug
This commit is contained in:
		| @@ -283,21 +283,24 @@ 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))) { | ||||||
|         element.append(`<button id='${add}' title='{% trans "Add new filter" %}' class='btn btn-default filter-tag'><span class='fas fa-filter'></span></button>`); |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|         if (Object.keys(filters).length > 0) { |     // If there are filters currently "in use", add them in! | ||||||
|             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='${add}' title='{% trans "Add new filter" %}' class='btn btn-default filter-tag'><span class='fas fa-filter'></span></button>`); | ||||||
|         } |  | ||||||
|  |  | ||||||
|         for (var key in filters) { |     if (Object.keys(filters).length > 0) { | ||||||
|             var value = getFilterOptionValue(tableKey, key, filters[key]); |         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>`); | ||||||
|             var title = getFilterTitle(tableKey, key); |     } | ||||||
|             var description = getFilterDescription(tableKey, key); |  | ||||||
|  |  | ||||||
|             element.append(`<div title='${description}' class='filter-tag'>${title} = ${value}<span ${tag}='${key}' class='close'>x</span></div>`); |     for (var key in filters) { | ||||||
|         } |         var value = getFilterOptionValue(tableKey, key, filters[key]); | ||||||
|  |         var title = getFilterTitle(tableKey, key); | ||||||
|  |         var description = getFilterDescription(tableKey, key); | ||||||
|  |  | ||||||
|  |         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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user