From 7533a9ac0c8efa96a4840963fcc50d3c68e519b0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 20 Aug 2021 22:51:36 +0200 Subject: [PATCH 1/4] disable ordering on IPN if fixed ordering --- InvenTree/templates/js/translated/part.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index 4ed631fe61..a5f296bf3f 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -814,11 +814,14 @@ function loadPartTable(table, url, options={}) { }); } - columns.push({ + col = { field: 'IPN', title: 'IPN', - sortable: true, - }), + }; + if (!options.params.ordering) { + col['sortable'] = true; + }; + columns.push(col); columns.push({ field: 'name', From 109b8c943e44f69db073dcb3ad51d90a59602e77 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 20 Aug 2021 22:52:14 +0200 Subject: [PATCH 2/4] disable ordering on part-name --- InvenTree/templates/js/translated/part.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index a5f296bf3f..4e663faaa9 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -823,10 +823,9 @@ function loadPartTable(table, url, options={}) { }; columns.push(col); - columns.push({ + col = { field: 'name', title: '{% trans "Part" %}', - sortable: true, switchable: false, formatter: function(value, row, index, field) { @@ -854,7 +853,11 @@ function loadPartTable(table, url, options={}) { return display; } - }); + }; + if (!options.params.ordering) { + col['sortable'] = true; + }; + columns.push(col); columns.push({ field: 'description', From 5a59a37a89c25a900a1ff72ff503b862b64088e7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 20 Aug 2021 22:52:57 +0200 Subject: [PATCH 3/4] disable ordering on category --- InvenTree/templates/js/translated/part.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index 4e663faaa9..937355250a 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -872,8 +872,7 @@ function loadPartTable(table, url, options={}) { } }); - columns.push({ - sortable: true, + col = { sortName: 'category', field: 'category_detail', title: '{% trans "Category" %}', @@ -885,7 +884,11 @@ function loadPartTable(table, url, options={}) { return '{% trans "No category" %}'; } } - }); + }; + if (!options.params.ordering) { + col['sortable'] = true; + }; + columns.push(col); columns.push({ field: 'in_stock', From 8fad704d76db3d19ec0ef6ae1085c9dc237e3b18 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 20 Aug 2021 22:53:25 +0200 Subject: [PATCH 4/4] disable ordering on stock --- InvenTree/templates/js/translated/part.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index 937355250a..c828d8f66f 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -890,11 +890,10 @@ function loadPartTable(table, url, options={}) { }; columns.push(col); - columns.push({ + col = { field: 'in_stock', title: '{% trans "Stock" %}', searchable: false, - sortable: true, formatter: function(value, row, index, field) { var link = "stock"; @@ -921,7 +920,11 @@ function loadPartTable(table, url, options={}) { return renderLink(value, '/part/' + row.pk + "/" + link + "/"); } - }); + }; + if (!options.params.ordering) { + col['sortable'] = true; + }; + columns.push(col); columns.push({ field: 'link',