So I tried to track down the cause of this one, but I failed miserably after a few hours. This is possibly related to #1537532: Can't modify or remove sort criteria, but possibly not.

I'm hitting a problem where when I click on the "Draggableviews: Weight" sort criteria settings, the ajax overlay does not open up. This is for a View that is going to use the weight values from another view. So this one is not 'self' and must build all of the other enabled views to assemble the list of "Display sort as" options.

I hit the problem using Better Exposed Filters. So it is possible that this is a bug for that module, but I suspect any module with an exposed filter that adds Javascript will trigger this issue.

You must configure an exposed filter, with Better Exposed Filters chosen as the form style, and (most importantly) you must use a BEF setting that adds Javascript to the output during form building. For example, if you have a taxonomy term filter that allows multiple selections, and then use BEF's "Add select all/none links" option, you will hit this issue. BEF does not always add its Javascript file. My assumption is that any exposed filter that adds Javascript might trigger this issue.

If I configure BEF in such a way that there is no Javascript file added, everything is okay. If I configure BEF so that the Javascript file is added, Draggableviews cannot open the sort criteria settings window. Everything works fine if I disable views' javascript. (although I do see a lot of strange "Invalid argument supplied for foreach() in views_plugin_display->uses_exposed()" errors).

Everything works fine otherwise. It's just the weight sort criteria settings overlay that is the issue.

Any thoughts? Thanks!

Comments

jonmcl’s picture

StatusFileSize
new1.33 KB

I think this patch will solve the issue.

jonmcl’s picture

Status: Active » Needs review
JvE’s picture

StatusFileSize
new2.08 KB

That does improve things in that it does not build and render every single display of every single view.

Perhaps attached patch is even more efficient?

jonmcl’s picture

It looks much more efficient to me. No cloning and no execution of view methods at all. I haven't tested yet, but looks like a solid solution.

jawi’s picture

Can I use the patch with the latest dev version?

7.x-2.x-dev tar.gz (28.38 KB) | zip (41.02 KB) 2012-Aug-07

JvE’s picture

StatusFileSize
new1.41 KB

Ah, no. Sorry.
Attaching a new one.

jonmcl’s picture

I just gave patches #3 and #6 a try, but they didn't work for me. When I bring up the "Configure sort criterion" overlay for the Draggableview sort, the draggableviews_handler_sort handler no longer finds ANY views+displays that show in the "Display Sort As" pop-up select. That includes the the "self" setting that should be selected for the View that has the Draggableviews column (which is supposed to hide the "Display Sort As" pop-up)

The ->display_options['fields'] array is not yet set at that point. Did you have a different outcome?

jonmcl’s picture

StatusFileSize
new1.14 KB

Re-rolled my patch from #1 to work with current dev version

Jackinloadup’s picture

StatusFileSize
new1.01 KB

#8 JonMcL thanks fix worked great. This solved my issue in #1537532: Can't modify or remove sort criteria.

I rerolled this patch so it followed the Making a Drupal patch with Git guidelines. Aka made it not be depended on sites/all/modules sense some people run multisite environments.

Functionally patch is exactly the same. ^_^

jonmcl’s picture

Thanks @Jackinloadup. I have to work on my patch creation skills for sure.

While I think this patch is still valid and should prove to make things more reliable, unfortunately I hit a similar issue even with this patch in place. I have a complex view that also uses Views Quicksand (views_quicksand) and Views Load More (views_load_more). It seems that when I add Draggable Views to the mix, I end up not only having a similar issue in the admin UI (can't open sort settings for the Draggable Views sort), it also seems to mess with the other modules. Or maybe they are messing with DraggableViews.

My solution was to switch to a Field API sort handler instead of native. I have an admin View that has the DraggableViews: Content field (with Field API sort hander setting) and my content view (front-end facing) then just as the custom field in it's sort criteria.

If I find some time I will try and track down what my new specific issue is. Patch #9 should solve this situation (failure to load sort criteria setting) for most cases.

istryker’s picture

@JonMcL can you test #1765760: Views ajax error when you click 'update preview' or draggableviews:weight sort patch with this patch to see if it solves your

can't open sort settings for the Draggable Views sort
ygerasimov’s picture

Status: Needs review » Fixed

Committed #9. Thank you.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

caktux’s picture

Patch in #1 needs to be applied to 7.x-2.0 for it to be usable