mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improvements for parameteric part table (#4940)
- Initially only display columns which have data
This commit is contained in:
parent
2c58b2fd36
commit
cb0f0e34d9
@ -2025,6 +2025,7 @@ function loadParametricPartTable(table, options={}) {
|
||||
switchable: true,
|
||||
sortable: true,
|
||||
filterControl: 'input',
|
||||
visible: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -2053,6 +2054,9 @@ function loadParametricPartTable(table, options={}) {
|
||||
uniqueId: 'pk',
|
||||
onLoadSuccess: function(response) {
|
||||
|
||||
// Display columns as we receive data from them
|
||||
let activated_columns = [];
|
||||
|
||||
// Data may be returned paginated, in which case we preference response.results
|
||||
var data = response.results || response;
|
||||
|
||||
@ -2061,7 +2065,14 @@ function loadParametricPartTable(table, options={}) {
|
||||
|
||||
// Make each parameter accessible, based on the "template" columns
|
||||
row.parameters.forEach(function(parameter) {
|
||||
row[`parameter_${parameter.template}`] = parameter.data;
|
||||
let col_name = `parameter_${parameter.template}`;
|
||||
row[col_name] = parameter.data;
|
||||
|
||||
// Display the column if it is not already displayed
|
||||
if (!activated_columns.includes(col_name)) {
|
||||
activated_columns.push(col_name);
|
||||
$(table).bootstrapTable('showColumn', col_name);
|
||||
}
|
||||
});
|
||||
|
||||
data[idx] = row;
|
||||
|
Loading…
Reference in New Issue
Block a user