2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-05 06:48:48 +00:00

load category tables "Just in time"

This commit is contained in:
Oliver Walters 2022-03-18 23:28:46 +11:00
parent 335f0ceb79
commit 52a0665e32

View File

@ -240,9 +240,6 @@
{% endif %} {% endif %}
// Enable left-hand navigation sidebar
enableSidebar('category');
// Enable breadcrumb tree view // Enable breadcrumb tree view
enableBreadcrumbTree({ enableBreadcrumbTree({
label: 'category', label: 'category',
@ -258,18 +255,20 @@
} }
}); });
loadPartCategoryTable( onPanelLoad('subcategories', function() {
$('#subcategory-table'), { loadPartCategoryTable(
params: { $('#subcategory-table'), {
{% if category %} params: {
parent: {{ category.pk }}, {% if category %}
{% else %} parent: {{ category.pk }},
parent: null, {% else %}
{% endif %} parent: null,
}, {% endif %}
allowTreeView: true, },
} allowTreeView: true,
); }
);
});
$("#cat-create").click(function() { $("#cat-create").click(function() {
@ -339,19 +338,24 @@
{% endif %} {% endif %}
loadPartTable( onPanelLoad('parts', function() {
"#part-table", loadPartTable(
"{% url 'api-part-list' %}", "#part-table",
{ "{% url 'api-part-list' %}",
params: { {
{% if category %}category: {{ category.id }}, params: {
{% else %}category: "null", {% if category %}category: {{ category.id }},
{% endif %} {% else %}category: "null",
{% endif %}
},
buttons: ['#part-options'],
checkbox: true,
gridView: true,
}, },
buttons: ['#part-options'], );
checkbox: true, });
gridView: true,
}, // Enable left-hand navigation sidebar
); enableSidebar('category');
{% endblock %} {% endblock %}