Skip to content
Snippets Groups Projects
Commit 36ed48df authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Remove sorting on relationship columns

Sorting on manufacturer/model/location/status requires
a join which removes the row with empty field.
Disable it until we find a way to sort properly including null values.
parent df1fd16a
No related branches found
No related tags found
No related merge requests found
......@@ -73,14 +73,7 @@ def retrieve_items():
'status',
'parent',
)
field = getattr(models.Item, columns[order_column])
if 4 < order_column < 9:
query = query.join(field)
relationship_class = getattr(models, columns[order_column].title())
relationship_field = getattr(relationship_class, 'name')
query = query.order_by(order_dir(relationship_field))
else:
query = query.order_by(order_dir(getattr(models.Item, columns[order_column])))
query = query.order_by(order_dir(getattr(models.Item, columns[order_column])))
# Limit and offset the query
if per_page != -1:
query = query.limit(per_page)
......
......@@ -64,6 +64,10 @@ $(document).ready(function() {
"visible": false,
"searchable": false
},
{
"targets": [5, 6, 7, 8],
"orderable": false
},
{
"targets": [1, 9],
"render": function(data, type, row) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment