mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Option to disable filters for part table
This commit is contained in:
		@@ -81,15 +81,19 @@ function loadPartTable(table, url, options={}) {
 | 
			
		||||
     *  - table: HTML reference to the table
 | 
			
		||||
     *  - url: Base URL for API query
 | 
			
		||||
     *  - options: object containing following (optional) fields
 | 
			
		||||
     *      allowInactive: If true, allow display of inactive parts
 | 
			
		||||
     *      checkbox: Show the checkbox column
 | 
			
		||||
     *      query: extra query params for API request
 | 
			
		||||
     *      buttons: If provided, link buttons to selection status of this table
 | 
			
		||||
     *      disableFilters: If true, disable custom filters
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    var params = options.params || {};
 | 
			
		||||
 | 
			
		||||
    var filters = loadTableFilters("parts");
 | 
			
		||||
    var filters = {};
 | 
			
		||||
    
 | 
			
		||||
    if (!options.disableFilters) {
 | 
			
		||||
        filters = loadTableFilters("parts");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (var key in params) {
 | 
			
		||||
        filters[key] = params[key];
 | 
			
		||||
 
 | 
			
		||||
@@ -104,6 +104,7 @@ InvenTree | {% trans "Search Results" %}
 | 
			
		||||
        ],
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    $("#location-results-table").inventreeTable({
 | 
			
		||||
        url: "{% url 'api-location-list' %}",
 | 
			
		||||
        queryParams: {
 | 
			
		||||
@@ -124,16 +125,18 @@ InvenTree | {% trans "Search Results" %}
 | 
			
		||||
        ],
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    loadPartTable("#part-results-table",
 | 
			
		||||
        "{% url 'api-part-list' %}",
 | 
			
		||||
        {
 | 
			
		||||
            params: {
 | 
			
		||||
                search: "{{ query }}",
 | 
			
		||||
            },
 | 
			
		||||
            allowInactive: true,
 | 
			
		||||
            checkbox: false,
 | 
			
		||||
            disableFilters: true,
 | 
			
		||||
        }
 | 
			
		||||
    );
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    loadCompanyTable('#company-results-table', "{% url 'api-company-list' %}", {
 | 
			
		||||
        params: {
 | 
			
		||||
@@ -153,5 +156,5 @@ InvenTree | {% trans "Search Results" %}
 | 
			
		||||
            },
 | 
			
		||||
        }
 | 
			
		||||
    );
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -11,6 +11,7 @@
 | 
			
		||||
{% block collapse_content %}
 | 
			
		||||
<div id='button-toolbar'>
 | 
			
		||||
    <div class='button-toolbar container-fluid' style='float: right;'>
 | 
			
		||||
        <button class='btn btn-default'>Hello</button>
 | 
			
		||||
        <div class='filter-list' id='filter-list-parts'></div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user