mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
7d20003137
@ -210,7 +210,8 @@
|
||||
{% else %}
|
||||
parent: null,
|
||||
{% endif %}
|
||||
}
|
||||
},
|
||||
allowTreeView: true,
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -183,7 +183,8 @@
|
||||
{% else %}
|
||||
parent: 'null',
|
||||
{% endif %}
|
||||
}
|
||||
},
|
||||
allowTreeView: true,
|
||||
});
|
||||
|
||||
linkButtonsToSelection(
|
||||
|
@ -1133,8 +1133,10 @@ function loadPartTable(table, url, options={}) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display a table of part categories
|
||||
*/
|
||||
function loadPartCategoryTable(table, options) {
|
||||
/* Display a table of part categories */
|
||||
|
||||
var params = options.params || {};
|
||||
|
||||
@ -1157,15 +1159,15 @@ function loadPartCategoryTable(table, options) {
|
||||
|
||||
setupFilterList(filterKey, table, filterListElement);
|
||||
|
||||
var tree_view = inventreeLoad('category-tree-view') == 1;
|
||||
var tree_view = options.allowTreeView && inventreeLoad('category-tree-view') == 1;
|
||||
|
||||
table.inventreeTable({
|
||||
treeEnable: tree_view,
|
||||
rootParentId: options.params.parent,
|
||||
rootParentId: tree_view ? options.params.parent : null,
|
||||
uniqueId: 'pk',
|
||||
idField: 'pk',
|
||||
treeShowField: 'name',
|
||||
parentIdField: 'parent',
|
||||
parentIdField: tree_view ? 'parent' : null,
|
||||
method: 'get',
|
||||
url: options.url || '{% url "api-part-category-list" %}',
|
||||
queryParams: filters,
|
||||
@ -1176,7 +1178,7 @@ function loadPartCategoryTable(table, options) {
|
||||
name: 'category',
|
||||
original: original,
|
||||
showColumns: true,
|
||||
buttons: [
|
||||
buttons: options.allowTreeView ? [
|
||||
{
|
||||
icon: 'fas fa-bars',
|
||||
attributes: {
|
||||
@ -1215,9 +1217,11 @@ function loadPartCategoryTable(table, options) {
|
||||
);
|
||||
}
|
||||
}
|
||||
],
|
||||
] : [],
|
||||
onPostBody: function() {
|
||||
|
||||
if (options.allowTreeView) {
|
||||
|
||||
tree_view = inventreeLoad('category-tree-view') == 1;
|
||||
|
||||
if (tree_view) {
|
||||
@ -1238,6 +1242,7 @@ function loadPartCategoryTable(table, options) {
|
||||
$('#view-category-tree').removeClass('btn-secondary').addClass('btn-outline-secondary');
|
||||
$('#view-category-list').removeClass('btn-outline-secondary').addClass('btn-secondary');
|
||||
}
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
|
@ -1416,8 +1416,11 @@ function loadStockTable(table, options) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display a table of stock locations
|
||||
*/
|
||||
function loadStockLocationTable(table, options) {
|
||||
/* Display a table of stock locations */
|
||||
|
||||
var params = options.params || {};
|
||||
|
||||
@ -1443,15 +1446,15 @@ function loadStockLocationTable(table, options) {
|
||||
filters[key] = params[key];
|
||||
}
|
||||
|
||||
var tree_view = inventreeLoad('location-tree-view') == 1;
|
||||
var tree_view = options.allowTreeView && inventreeLoad('location-tree-view') == 1;
|
||||
|
||||
table.inventreeTable({
|
||||
treeEnable: tree_view,
|
||||
rootParentId: options.params.parent,
|
||||
rootParentId: tree_view ? options.params.parent : null,
|
||||
uniqueId: 'pk',
|
||||
idField: 'pk',
|
||||
treeShowField: 'name',
|
||||
parentIdField: 'parent',
|
||||
parentIdField: tree_view ? 'parent' : null,
|
||||
disablePagination: tree_view,
|
||||
sidePagination: tree_view ? 'client' : 'server',
|
||||
serverSort: !tree_view,
|
||||
@ -1465,6 +1468,8 @@ function loadStockLocationTable(table, options) {
|
||||
showColumns: true,
|
||||
onPostBody: function() {
|
||||
|
||||
if (options.allowTreeView) {
|
||||
|
||||
tree_view = inventreeLoad('location-tree-view') == 1;
|
||||
|
||||
if (tree_view) {
|
||||
@ -1485,8 +1490,9 @@ function loadStockLocationTable(table, options) {
|
||||
$('#view-location-tree').removeClass('btn-secondary').addClass('btn-outline-secondary');
|
||||
$('#view-location-list').removeClass('btn-outline-secondary').addClass('btn-secondary');
|
||||
}
|
||||
}
|
||||
},
|
||||
buttons: [
|
||||
buttons: options.allowTreeView ? [
|
||||
{
|
||||
icon: 'fas fa-bars',
|
||||
attributes: {
|
||||
@ -1525,7 +1531,7 @@ function loadStockLocationTable(table, options) {
|
||||
);
|
||||
}
|
||||
}
|
||||
],
|
||||
] : [],
|
||||
columns: [
|
||||
{
|
||||
checkbox: true,
|
||||
|
Loading…
Reference in New Issue
Block a user