When function sexy_exposed_views_pre_execute(&$view) calls several times for one view, it causing duplicaties in Drupal.setting.sexyExposed.

Because :

drupal_add_js(array('sexyExposed' => $needs_sexy_love),'setting');

runs several times with same array. Consequently "element" in Drupal.behaviors.sexyExposed function becomes array.

Drupal.behaviors.sexyExposed = function (context) {
  var settings = Drupal.settings.sexyExposed;
  $.each(settings, function(key, element) {
    $key = $(key);
    // Adjust max height if maximum number of visible items is set.
    if (element > 0) { // <-- it`s array now
      height = sexyExposedCalculateMaxHeight($key, element);
      $key.dropdownchecklist({maxDropHeight: height});
    }
    else if (element == 0) { // <-- it`s array now
      $key.dropdownchecklist();
    }
  });
};

As a result - none of conditions become true.

I offer my patch, wich uses static array for used elements keys.

Comments

pacufist’s picture

StatusFileSize
new1.59 KB

Sorry, found bug in patch. Attached fixed now.

zserno’s picture

Very good catch, thanks!
Apparently it's something I didn't think of. I'm curious about your setup.
Could you please share me how you run into this issue (e.g. multiple views panes in one panel)?
Patch looks good, so I'll include it in next release of both 6 and 7 branches. Thanks again.

pacufist’s picture

Thanks!

I Just use "Better formats" and "Views Selective Exposed Filters" in Views Hacks pack.

Without that ones all worked fine.

heyehren’s picture

Thanks Pacufist, the patch worked for me. It's working fine now with Views Selective Exposed Filters.