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;
|
var bom_items = buildInfo.bom_items || null;
|
||||||
|
|
||||||
// If BOM items have not been provided, load via the API
|
function loadBomData() {
|
||||||
if (bom_items == null) {
|
let data = [];
|
||||||
|
|
||||||
inventreeGet(
|
inventreeGet(
|
||||||
'{% url "api-bom-list" %}',
|
'{% url "api-bom-list" %}',
|
||||||
{
|
{
|
||||||
@ -1455,10 +1456,17 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
|||||||
{
|
{
|
||||||
async: false,
|
async: false,
|
||||||
success: function(results) {
|
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
|
// Apply filters to build table
|
||||||
@ -1510,8 +1518,14 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
|||||||
|
|
||||||
setupFilterList('builditems', $(table), options.filterTarget, {
|
setupFilterList('builditems', $(table), options.filterTarget, {
|
||||||
callback: function(table, filters, options) {
|
callback: function(table, filters, options) {
|
||||||
|
if (filters == null) {
|
||||||
|
// Destroy and re-create the table from scratch
|
||||||
|
$(table).bootstrapTable('destroy');
|
||||||
|
loadBuildOutputAllocationTable(buildInfo, output, options);
|
||||||
|
} else {
|
||||||
filterBuildAllocationTable(filters);
|
filterBuildAllocationTable(filters);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var allocated_items = output == null ? null : output.allocations;
|
var allocated_items = output == null ? null : output.allocations;
|
||||||
|
@ -429,7 +429,7 @@ function setupFilterList(tableKey, table, target, options={}) {
|
|||||||
|
|
||||||
// Callback for reloading the table
|
// Callback for reloading the table
|
||||||
element.find(`#reload-${tableKey}`).click(function() {
|
element.find(`#reload-${tableKey}`).click(function() {
|
||||||
reloadTableFilters(table, {}, options);
|
reloadTableFilters(table, null, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add a callback for downloading table data
|
// Add a callback for downloading table data
|
||||||
|
@ -154,6 +154,8 @@ icalendar==5.0.5
|
|||||||
# via django-ical
|
# via django-ical
|
||||||
idna==3.4
|
idna==3.4
|
||||||
# via requests
|
# via requests
|
||||||
|
importlib-metadata==6.6.0
|
||||||
|
# via markdown
|
||||||
inflection==0.5.1
|
inflection==0.5.1
|
||||||
# via drf-spectacular
|
# via drf-spectacular
|
||||||
itypes==1.2.0
|
itypes==1.2.0
|
||||||
@ -291,6 +293,8 @@ xlrd==2.0.1
|
|||||||
# via tablib
|
# via tablib
|
||||||
xlwt==1.3.0
|
xlwt==1.3.0
|
||||||
# via tablib
|
# via tablib
|
||||||
|
zipp==3.15.0
|
||||||
|
# via importlib-metadata
|
||||||
zopfli==0.2.2
|
zopfli==0.2.2
|
||||||
# via fonttools
|
# via fonttools
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user