Problem/Motivation
The same problem was reported for the child-module in #3617689: Tabledraggers are missing but this (parent) module seem to also suffer from this bug.
Or maybe the fields were never meant to be sortable?
I don't see the tabledraggers (tabledrag-cell's are set to display: none) under "Sorts" (/admin/config/search/search-api/index/INDEX_ID/sorts/VIEWS_ID).
I need to use the "Show row weights" option, and enter for example "-1" to re-order the fields, though the values don't seem to be saved.
Steps to reproduce
Proposed resolution
Check if the fields should be sortable.
If, yes show the tabledraggers, and save the order when saved.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork search_api_sorts-3617951
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
peri22 commentedThanks for the report! I confirmed this, and it has the exact same cause as the bug in the widget submodule.
The drag handles are missing because "Weight" is the first column. Core's tabledrag script hides the weight cell but also puts the drag handle in that exact same first cell, so the handle becomes invisible.
MR !17 moves the Weight column to the right end of the table. It also fixes a small issue with the "Translate" cell: disabled rows used to have one less cell, which would shift the column index now that Weight is at the end. The Translate cell is now correctly rendered for all rows.
About the weights not being saved: this is expected behavior. The form only saves configuration for enabled sorts. When a row is unchecked, its config is deleted and its weight is discarded. Enabled rows do keep their order. If you'd like to change the form so it stops offering weight controls for disabled rows, please open a separate issue for that.
The pipeline is red, but none of it comes from this change.
Comment #5
ressaThank you so much for a fast answer, and taking the time to explain in detail why the order is not saved for inactive rows. The current state is perfectly fine, since normally you would not need to change the order of inactive fields -- dragging the active fields to the top and re-ordering them is probably what most users will do.
The MR works perfectly, and I can now drag and save the order of fields as expected. And thanks for creating an issue to get the tests in a good state, I really appreciate it!
Comment #6
jeroentMerged to 8.x-1.x. Thanks!