2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 21:45:39 +00:00

Added 'Parametric Table' tab to category detail view, added part_count to 'Parts' tab

This commit is contained in:
eeintech
2020-09-29 15:16:12 -05:00
parent 9e4a599c44
commit 6b48977e7b
7 changed files with 109 additions and 2 deletions

View File

@ -163,6 +163,51 @@ function loadSimplePartTable(table, url, options={}) {
}
function loadParametricPartTable(table, url, options={}) {
/* Load parametric part data into specified table.
*
* Args:
* - table: HTML reference to the table
* - url: Base URL for API query
*/
// Ensure category detail is included
options.params['category_detail'] = true;
var params = options.params || {};
console.log(params)
var filters = {};
for (var key in params) {
filters[key] = params[key];
}
console.log(filters)
var columns = [
{
field: 'pk',
title: 'ID',
visible: true,
switchable: true,
searchable: false,
}
];
$(table).inventreeTable({
url: url,
sortName: 'pk',
method: 'get',
queryParams: filters,
groupBy: false,
name: options.name || 'part',
original: params,
formatNoMatches: function() { return "{% trans "No parts found" %}"; },
columns: columns,
showColumns: true,
});
}
function loadPartTable(table, url, options={}) {
/* Load part listing data into specified table.
*