I've created a view and used the flexslider views style but the rendered flexslider appears to be ignoring my sort criteria. I'm currently using an integer field attached to the node but I've also tried using the node title but neither work. changing the views format to anything else restores the correct order of content.

Comments

mike stewart’s picture

Status: Active » Postponed (maintainer needs more info)

Hmm, not enough info to reproduce. Screenshot? Views export?

However, my understanding is flexislider will just take advantage of the order < ul > < li > <img > HTML structure as rendered. In other words, it sounds like views is either not sorting how you'd like -- or you need to clear your cache

joshua.howell’s picture

here is a screenshot of the resulting HTML;
http://joshuahowell.org/sites/default/files/flexslider-html.jpg

here is the views export;

$view = new view();
$view->name = 'home_page_slideshow';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Home Page Slideshow';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Home Page Slideshow';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['style_plugin'] = 'flexslider';
$handler->display->display_options['style_options']['id'] = 'home-page-slideshow';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Content: Image */
$handler->display->display_options['fields']['field_image']['id'] = 'field_image';
$handler->display->display_options['fields']['field_image']['table'] = 'field_data_field_image';
$handler->display->display_options['fields']['field_image']['field'] = 'field_image';
$handler->display->display_options['fields']['field_image']['label'] = '';
$handler->display->display_options['fields']['field_image']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_image']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_image']['settings'] = array(
'image_style' => 'adaptive',
'image_link' => '',
);
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Sort criterion: Content: Slide Number (field_slide_number) */
$handler->display->display_options['sorts']['field_slide_number_value']['id'] = 'field_slide_number_value';
$handler->display->display_options['sorts']['field_slide_number_value']['table'] = 'field_data_field_slide_number';
$handler->display->display_options['sorts']['field_slide_number_value']['field'] = 'field_slide_number_value';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'home_page_slide' => 'home_page_slide',
);
/* Filter criterion: Content: Promoted to front page */
$handler->display->display_options['filters']['promote']['id'] = 'promote';
$handler->display->display_options['filters']['promote']['table'] = 'node';
$handler->display->display_options['filters']['promote']['field'] = 'promote';
$handler->display->display_options['filters']['promote']['value'] = '1';

/* Display: Home Page Slideshow Block */
$handler = $view->new_display('block', 'Home Page Slideshow Block', 'block');

joshua.howell’s picture

I just unchecked the "Loop Slideshow" option and now it is correctly displaying my views sort order.

byronveale’s picture

Status: Postponed (maintainer needs more info) » Active

Thank you Joshua, your last comment just saved me from going insane.

Yes, after much head-scratching and process of elimination over this same kind of behavior, I deduced that it was FlexSlider that was throwing off my sort; either that or FlexSlider Views Slideshow, but that module doesn't yet have any issue opened for this kind of behavior (the one issue found has the word "sort" 17 times in exported Views code). Joshua, just to try to narrow things down, are you using FlexSlider Views Slideshow?

Turning off looping fixes the behavior for me too.

If I choose "Cycle" instead of "FlexSlider" as my slideshow type (have views_slideshow_cycle enabled, jquery.cycle library installed), the view sorts properly.

Hope I'm not being presumptuous in setting the status back to "Active".

If need be, I can export a view.

Thanks to the maintainers for your efforts…

Here's my local environment:

Mac OS X 10.9.5
Acquia DevDesktop 7.29.34
Drupal 7.31
Database system MySQL
Database system version 5.1.66
Database updates Up to date
FlexSlider FlexSlider library installed.
Version 2.2 installed
PHP 5.3.18
PHP extensions Enabled
PHP memory limit 256M
PHP register globals Disabled
Web server Apache/2.2.25 (Unix) PHP/5.3.18

joshua.howell’s picture

Hello byronveale, no i'm not using FlexSlider Views Slideshow. I believe it is the Flexslider code that enables the "Loop Slideshow" that is causing the error with the views sort order. The rendered HTML if rather confusing and although we've discovered a workaround this bug is still very much present and easy to replicate. I hope the maintainers are able to look into it further as some stage.

joshua.howell’s picture

Mike, are you able to look into this at some stage please? It should be very easy to reproduce.

kvnm’s picture

Same story here -- turning off looping solves the sort issue.

rodpal’s picture

+ 1

This is happening using a custon date field as order in my view:

$handler->display->display_options['sorts']['field_fecha_value']['id'] = 'field_fecha_value';
$handler->display->display_options['sorts']['field_fecha_value']['table'] = 'field_data_field_fecha';
$handler->display->display_options['sorts']['field_fecha_value']['field'] = 'field_fecha_value';
$handler->display->display_options['sorts']['field_fecha_value']['order'] = 'DESC';

thalemn’s picture

+1

Same issue for me using custom date field to sort view. I want the view to continue cycling, but then the sort order is more or less random. As soon as I turn off the cycling, the view sorts as expected.

My workaround:

Switch to Basic Carousel
Max items 1
Move 5 (you can also set this 0 for all items)

The Basic Carousel when using the Loop Slideshow option, does not appear to create a sort order problem.

T-Bone Rey Website with Flexslider using Basic Carousel

Update:

So I checked the site later this evening and the order is now incorrect. Strange.

So now I'm trying the Flexslider Carousel with min and max ranges.

Min 1
Max 1
Move 1

Seems to have the sort order correct now.

amaria’s picture

Status: Active » Closed (works as designed)

A solution has been given for this so closing.