Download & Extend

Views UI AJAX response causes duplicate Drupal.behaviors.dhtmlMenu call

Project:DHTML Menu
Version:6.x-2.x-dev
Component:Javascript code
Category:bug report
Priority:normal
Assigned:cburschka
Status:active

Issue Summary

While editing a view via the Views UI, the DHTML module's menu effects become disabled. Functionality returns once the Views editing page is exited. This was actually present in beta2, as well (but I don't think it was present before that).

Comments

#1

Project:Views» DHTML Menu
Version:6.x-2.0-beta3» 6.x-2.0
Component:Miscellaneous» Javascript code

Hmm, that's neat.

FYI this only happens after an AJAX request has been made by Views. My guess is that DHTML Menu has a problem with its behaviors code that causes it to fail when Views' behaviors are rerun.

#2

Is there any error console output? I'll test it shortly.

#3

Title:Views UI Disables DHTML Menu Effects» Views UI causes duplicate DHTML Menu switch

The behavior I have observed with the latest versions of Drupal 6, DHTML Menu and Views is that the menu is switched twice. It opens and closes, or closes and opens.

This indicates that the switchMenu() function is called twice. I shall investigate.

#4

Priority:minor» normal
Assigned to:Anonymous» cburschka

Diagnosis: The response to the Views AJAX request causes Drupal.behaviors.dhtmlMenu() to be called again, adding listeners twice.

I have to take this to irc; Drupal's JS behaviors are beyond me.

Views is an essential module, though, so this bug isn't minor.

#5

Title:Views UI causes duplicate DHTML Menu switch» Views UI AJAX response causes duplicate Drupal.behaviors.dhtmlMenu call

Updated.

#6

Nobody's answering in IRC, but merlin's post hints that the behaviors are supposed to be re-run. This means I will set a flag to ensure the function cancels when it is called again.

#7

Version:6.x-2.0» 6.x-2.x-dev
Status:active» needs review

I'm declaring a script-scope variable named dhtmlRun and checking it in the behaviors function. If it's true, the function returns, otherwise it is set to true.

This fixes the problem; AJAX requests in Views now no longer break DHTML Menu.

AttachmentSize
dhtml_menu-js-behaviors-dupe-260754-7.patch 673 bytes

#8

Status:needs review» fixed

Committed to HEAD.

#9

Status:fixed» closed (fixed)

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

#10

Status:closed (fixed)» active

This exact same behaviour appears when Ajax editablefields are exposed whilst viewing a node (nothing to do with Views). The DHTML menus open/close or close/open... also the top submenu entry in the menu you are trying to expand starts getting duplicated - I have ended up with 4 copies of the parent menu's home page submenu entry. When I turn off the option that creates a submenu entry for the parent menu entry's page, it simply duplicates the next submenu entry along...

#11

Just noticed that the submenu entry representing the parent menu (enabled by an option in DHTML Menu) duplicates even when you sort a Views view using AJAX clickable column headings. As soon as you turn off AJAX the behaviour goes away.

#12

for you information, this patch woks, but it is not jet in the d7 branch. so in the d7 version you will have exactly that problem.

#13