I noticed an issue with the latest dev version of the CTools Views Content module. When a view is created with exposed sorts and the view pane is added to a panel page and you configure the view pane settings in panels, the Sort By and Sort Order dropdowns do not retain the value you select.

Steps to reproduce:

  1. Create a view with a content pane display.
  2. Add a few sort criteria and set them as exposed.
  3. In the view's pane settings section, select "Use exposed widgets form as pane configuration" under Allow Settings.
  4. Add the view pane to a panel/panelized page.
  5. In the view pane's settings, select a different value in the Sort By and Sort Order dropdowns, then click Finish.
  6. Go back into the view pane's settings and you will see that the dropdowns have reverted back to their default values instead of the values you selected in the previous step.

Some additional information that may help narrow down the issue:

  • Exposed filters work as expected. The issue is limited to exposed sorts.
  • The exposed sort option appears to be saved to the database since previewing or saving and viewing the page shows the view with the correct sort order. However if you go back into the view pane's settings form, the dropdowns do not show the correct value so I think the issue is with reading the current configuration from the database and selecting the correct Sort By/Order values in the dropdowns.


Jānis Bebrītis’s picture

Project: Chaos tool suite (ctools) » Views
Version: 7.x-1.x-dev » 7.x-3.x-dev
Component: Views Content » exposed filters

I stumbled across the same issue - we're using views panes and none of sorts would display saved values. I debugged it to views module, filters actually get wrong default values.

Here's patch (for latest 7.x-3.x) I created to solve this issue.

Jānis Bebrītis’s picture

1.38 KB
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: tests were executed, but no results were found. View

Somehow I lost the patch, here it is

Jānis Bebrītis’s picture

Status: Active » Needs review

changing status

jlapp’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thanks Janis, your patch in #2 resolved this issue for me!

dsnopek’s picture

RTBC +1!

We're using this patch in Panopoly. :-)

guillaumev’s picture

Just confirming that this is also working on my side.

dsnopek’s picture

Issue tags: +panopoly

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: views-exposed-sorts-2037469-1.patch, failed testing.

mglaman’s picture

Status: Needs work » Reviewed & tested by the community

Looks like a test bot hiccup. Putting back to RTC.

Detect a test run failure
Ensure that you can install SimpleTest locally and invoke tests using the command line script.

thePanz’s picture

The patches in #2 fixes the issue and correctly applies on latest 3.11 release.

spesic’s picture

Updated #2 to check sort_order property before accessing it to avoid php notice spam. Default to original sort if the property is undefined.

spesic’s picture

Status: Reviewed & tested by the community » Needs review
nbucknor’s picture

patch #12 works for me.

shivneel’s picture

Patch #12 fixes the issue and correctly applies on 3.11 release for me as well.

dobe’s picture

So I have been working on similar issues. I am running panopoly so this patch was already applied. But then I started seeing issues with the default "sort_by" & "sort order" not getting applied for exposed sorts.

I found the issue: https://www.drupal.org/node/666870 which is fairly old but for the most part the approach looked good to me over there. I took that patch applied it to this one in addition I fixed the issue where the default sort order wasn't getting applied.

This patch seems to be fixing all my issues.

If this patch is good we need to make sure to give credit for all those found in: https://www.drupal.org/node/666870

humansky’s picture

Status: Needs review » Reviewed & tested by the community

#16 Works like a charm.

Also, for the Panopoly folks, I added a patch here: #2782721: Exposed Views Sort Order Bug