diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 2e6ebb7fca..c6fa5e84d6 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -128,6 +128,13 @@
  • {% trans "Export Data" %}
  • + + +
    @@ -169,6 +176,22 @@ toggleId: '#category-menu-toggle', }); + $('#view-list').hide(); + + $('#view-list').click(function() { + $('#view-list').hide(); + $('#view-grid').show(); + + $('#part-table').bootstrapTable('toggleCustomView'); + }); + + $('#view-grid').click(function() { + $('#view-grid').hide(); + $('#view-list').show(); + + $('#part-table').bootstrapTable('toggleCustomView'); + }); + $("#cat-create").click(function() { launchModalForm( "{% url 'category-create' %}", @@ -273,6 +296,7 @@ }, buttons: ['#part-options'], checkbox: true, + gridView: true, }, ); diff --git a/InvenTree/templates/js/part.js b/InvenTree/templates/js/part.js index a5b6def921..5c2840b121 100644 --- a/InvenTree/templates/js/part.js +++ b/InvenTree/templates/js/part.js @@ -347,7 +347,6 @@ function loadPartTable(table, url, options={}) { * query: extra query params for API request * buttons: If provided, link buttons to selection status of this table * disableFilters: If true, disable custom filters - * gridView: If true, display as grid rather than standard table */ // Ensure category detail is included @@ -511,8 +510,8 @@ function loadPartTable(table, url, options={}) { formatNoMatches: function() { return '{% trans "No parts found" %}'; }, columns: columns, showColumns: true, - showCustomView: true, - showCustomViewButton: true, + showCustomView: false, + showCustomViewButton: false, customView: function(data) { var html = ''; @@ -524,7 +523,7 @@ function loadPartTable(table, url, options={}) { return `
    ${html}
    `; } }); - + if (options.buttons) { linkButtonsToSelection($(table), options.buttons); }