mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add reload functionality for build item table (#4799)
* Add reload functionality for build item table * Update requirements.txt file (cherry picked from commit c976d06ec75d17e4c2fd4e557eb0bda858ae391e)
This commit is contained in:
parent
306f36bff8
commit
41cef1a190
@ -1443,8 +1443,9 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
||||
|
||||
var bom_items = buildInfo.bom_items || null;
|
||||
|
||||
// If BOM items have not been provided, load via the API
|
||||
if (bom_items == null) {
|
||||
function loadBomData() {
|
||||
let data = [];
|
||||
|
||||
inventreeGet(
|
||||
'{% url "api-bom-list" %}',
|
||||
{
|
||||
@ -1455,10 +1456,17 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
||||
{
|
||||
async: false,
|
||||
success: function(results) {
|
||||
bom_items = results;
|
||||
data = results;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
// If BOM items have not been provided, load via the API
|
||||
if (bom_items == null) {
|
||||
bom_items = loadBomData();
|
||||
}
|
||||
|
||||
// Apply filters to build table
|
||||
@ -1510,7 +1518,13 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
||||
|
||||
setupFilterList('builditems', $(table), options.filterTarget, {
|
||||
callback: function(table, filters, options) {
|
||||
filterBuildAllocationTable(filters);
|
||||
if (filters == null) {
|
||||
// Destroy and re-create the table from scratch
|
||||
$(table).bootstrapTable('destroy');
|
||||
loadBuildOutputAllocationTable(buildInfo, output, options);
|
||||
} else {
|
||||
filterBuildAllocationTable(filters);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -429,7 +429,7 @@ function setupFilterList(tableKey, table, target, options={}) {
|
||||
|
||||
// Callback for reloading the table
|
||||
element.find(`#reload-${tableKey}`).click(function() {
|
||||
reloadTableFilters(table, {}, options);
|
||||
reloadTableFilters(table, null, options);
|
||||
});
|
||||
|
||||
// Add a callback for downloading table data
|
||||
|
@ -154,6 +154,8 @@ icalendar==5.0.5
|
||||
# via django-ical
|
||||
idna==3.4
|
||||
# via requests
|
||||
importlib-metadata==6.6.0
|
||||
# via markdown
|
||||
inflection==0.5.1
|
||||
# via drf-spectacular
|
||||
itypes==1.2.0
|
||||
@ -291,6 +293,8 @@ xlrd==2.0.1
|
||||
# via tablib
|
||||
xlwt==1.3.0
|
||||
# via tablib
|
||||
zipp==3.15.0
|
||||
# via importlib-metadata
|
||||
zopfli==0.2.2
|
||||
# via fonttools
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user