i have created a relatively simple view using the views ui. it is a listing of nodes, which have a couple custom fields.

for some reason, the generated sql for the view always includes an order by clause (it is always ordering by field_priority), and it does not change regardless of what sort fields i select and configure. i will upload a couple screen shots to demonstrate.

any thoughts would be appreciated. thanks!

 

Comments

this image shows the generated sql with NO SORT FIELDS. note that it still has an order by clause.

this image shows the generated sql with a sort field selected. note that the generated sql has ignored the sort field completely, and is using a completely different field for sorting.

i created a new view, and at least i am not having that same problem.

i noticed that i cannot expose a sort criteria for some reason. when i choose to expose one, nothing changes in the displayed view, even on the preview.

is there something different about how views works in backdrop, relative to drupal 7?

thanks for the response, brad. the view is for a page display, no grouping.

funny thing about the exposed sort issue: on the first view, where i could not get it to sort by any field other than the field_priority, that field was in fact sortable in the resulting view - it had the sort arrow in the column header, and clicking it reversed the sort order.

now, in the new view, i cannot get any field to be sortable by the user.

i will likely end up doing what i almost always did in drupal anyway: create my own queries and display templates, only using views for things like reference picklists and the like. i always found views to be conceptually awesome, extraordinarily useful for non-programmers, and a relatively low bang-for-buck ratio for developers familiar and comfortable with databases working on complex projects. just my take.

I should have said "Format" not display - I meant, are you displaying results in an unformatted list, a grid, a table, etc. The Table format has its own "Sortable?" attribute for the fields, separate from the view's sort.

So apart from the known bug with exposing the view sort fields, hard to say what was happening with the rest of it. I can tell you that views sorting is not broken in a general sense - I can make views and they sort by the fields I choose. These are simple test cases, though. The details of exactly what your views are doing doubtless make a difference.