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',
title: 'IPN',
sortable: true,
}),
};
if (!options.params.ordering) {
col['sortable'] = true;
};
columns.push(col);
columns.push({
col = {
field: 'name',
title: '{% trans "Part" %}',
sortable: true,
switchable: false,
formatter: function(value, row, index, field) {
@ -851,7 +853,11 @@ function loadPartTable(table, url, options={}) {
return display;
}
});
};
if (!options.params.ordering) {
col['sortable'] = true;
};
columns.push(col);
columns.push({
field: 'description',
@ -866,8 +872,7 @@ function loadPartTable(table, url, options={}) {
}
});
columns.push({
sortable: true,
col = {
sortName: 'category',
field: 'category_detail',
title: '{% trans "Category" %}',
@ -879,13 +884,16 @@ function loadPartTable(table, url, options={}) {
return '{% trans "No category" %}';
}
}
});
};
if (!options.params.ordering) {
col['sortable'] = true;
};
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";
@ -912,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',