Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the Views settings for Datatables if you choose default order for any of the columns as Descending and then click that column as the default sor the order will appear properly in the preview. On the actual view of the page or block it always sorts the columns Ascending.
Comment | File | Size | Author |
---|---|---|---|
#6 | datatables-fix-default-sort-1507778-4.patch | 552 bytes | formatC'vt |
#4 | datatables-fix-default-sort-1507778-3.patch | 575 bytes | gnal |
Comments
Comment #1
gnal CreditAttribution: gnal commentedConfirming this one for datatables 7.x-1.1. Setting a column to default sort desceding does not change the view's default sorting. Tried it for both numerical and string type columns.
Comment #2
gnal CreditAttribution: gnal commentedComment #3
gnal CreditAttribution: gnal commentedComment #4
gnal CreditAttribution: gnal commentedSubmitting a patch that seems to fix it. Just changing the $options key that contains the default sort value.
Comment #5
sanchiz CreditAttribution: sanchiz commentedIt fixed sorting for me. Looks RTBC.
Comment #6
formatC'vt CreditAttribution: formatC'vt commentedI can't apply this patch for 7.x-1.x-dev, patch is outdated
upload new one.
Comment #7
Elin Yordanov CreditAttribution: Elin Yordanov commentedUpdating the issue status.
Comment #8
Elin Yordanov CreditAttribution: Elin Yordanov commentedOh sorry, selected wrong status, it's RTBC :)
Comment #10
Elin Yordanov CreditAttribution: Elin Yordanov commentedComment #13
Donit CreditAttribution: Donit commentedI've tested the current stable and dev version for D7. Default Sort Descending still doesn't work.
Comment #14
konordo CreditAttribution: konordo commentedDatatable counts all the fields in the view in order to determine the position of the sort column, howerver we need to skip the fields that exist in the view but have the Exclude from display checkbox enabled: