Merge pull request #1987 from matmair/fix-for-1986

Disable table sorting when order is fixed
This commit is contained in:
Oliver 2021-08-22 23:47:21 +10:00 committed by GitHub
commit 370fbea396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -814,16 +814,18 @@ function loadPartTable(table, url, options={}) {
}); });
} }
columns.push({ col = {
field: 'IPN', field: 'IPN',
title: 'IPN', title: 'IPN',
sortable: true, };
}), if (!options.params.ordering) {
col['sortable'] = true;
};
columns.push(col);
columns.push({ col = {
field: 'name', field: 'name',
title: '{% trans "Part" %}', title: '{% trans "Part" %}',
sortable: true,
switchable: false, switchable: false,
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
@ -851,7 +853,11 @@ function loadPartTable(table, url, options={}) {
return display; return display;
} }
}); };
if (!options.params.ordering) {
col['sortable'] = true;
};
columns.push(col);
columns.push({ columns.push({
field: 'description', field: 'description',
@ -866,8 +872,7 @@ function loadPartTable(table, url, options={}) {
} }
}); });
columns.push({ col = {
sortable: true,
sortName: 'category', sortName: 'category',
field: 'category_detail', field: 'category_detail',
title: '{% trans "Category" %}', title: '{% trans "Category" %}',
@ -879,13 +884,16 @@ function loadPartTable(table, url, options={}) {
return '{% trans "No category" %}'; return '{% trans "No category" %}';
} }
} }
}); };
if (!options.params.ordering) {
col['sortable'] = true;
};
columns.push(col);
columns.push({ col = {
field: 'in_stock', field: 'in_stock',
title: '{% trans "Stock" %}', title: '{% trans "Stock" %}',
searchable: false, searchable: false,
sortable: true,
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
var link = "stock"; var link = "stock";
@ -912,7 +920,11 @@ function loadPartTable(table, url, options={}) {
return renderLink(value, '/part/' + row.pk + "/" + link + "/"); return renderLink(value, '/part/' + row.pk + "/" + link + "/");
} }
}); };
if (!options.params.ordering) {
col['sortable'] = true;
};
columns.push(col);
columns.push({ columns.push({
field: 'link', field: 'link',