2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 11:36:44 +00:00

Improve sorting of part column for BOM table (#5386) (#5387)

(cherry picked from commit c39ae80a135c467741c6a573abaad684fad606b3)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot] 2023-08-02 17:43:08 +10:00 committed by GitHub
parent ca986cba01
commit aacf35ed47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -905,6 +905,18 @@ function loadBomTable(table, options={}) {
title: '{% trans "Part" %}',
sortable: true,
switchable: false,
sorter: function(_valA, _valB, rowA, rowB) {
let name_a = rowA.sub_part_detail.full_name;
let name_b = rowB.sub_part_detail.full_name;
if (name_a > name_b) {
return 1;
} else if (name_a < name_b) {
return -1;
} else {
return 0;
}
},
formatter: function(value, row) {
var url = `/part/${row.sub_part}/`;
var html = '';