Active
Project:
Sexy Exposed
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Oct 2011 at 22:16 UTC
Updated:
15 Jun 2012 at 14:42 UTC
Jump to comment: Most recent file
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.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | sexy_exposed_duplicate_js_setting.patch | 1.59 KB | pacufist |
| sexy_exposed_duplicate_js_setting.patch | 1.59 KB | pacufist |
Comments
Comment #1
pacufist commentedSorry, found bug in patch. Attached fixed now.
Comment #2
zserno commentedVery 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.
Comment #3
pacufist commentedThanks!
I Just use "Better formats" and "Views Selective Exposed Filters" in Views Hacks pack.
Without that ones all worked fine.
Comment #4
heyehren commentedThanks Pacufist, the patch worked for me. It's working fine now with Views Selective Exposed Filters.