Expand items that are set to be always expanded.
justdoit - December 9, 2008 - 21:37
| Project: | DHTML Menu |
| Version: | 7.x-1.x-dev |
| Component: | User Interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Jump to:
Description
Why in ver. 3.2 this module ignore default expanded menu item? In ver. 2.2 it worked well.
I would like to when open the site, some items have already been expanded.

#1
This may be a bug. After updating to 6.x-3.3, could you please check the following:
1.) Disable the "Close siblings" effect in DHTML Menu settings (if it is enabled)
2.) Open a few menus
3.) Click a link to another page
4.) Check whether the menus you opened in 2.) are still open.
If this works, and you mean the "always expanded" menus set in the menu settings are not automatically open, that isn't possible right now, but may be added in a future version.
#2
The help text on the click box for expanded reads "If selected and this menu item has children, the menu will always appear expanded."
And that's the functionality I thought I'd seen in the past and need for my current site. +1 on the feature request. In the mean time, the help text should be changed to something like "If selected, this menu will stay expanded after the user expands it."
#3
I'm interesting too!
I'd like to have expansion menu as a default behaviour...
#4
Any update on this? I would like this feature too work as well
#5
I just hacked together this bit of code to open up one of my top level menu items by default when the page is loaded.
It's not ideal, but it might help somebody else who needs this functionality
Added to the header section of page.tpl.php
<script>$(document).ready(function(){
var mId = 798; //the menu id which will be expanded
$('#dhtml_menu-'+mId).parent().removeClass('collapsed')
$('#dhtml_menu-'+mId).parent().addClass('expanded')
$('#dhtml_menu-'+mId).parent().children('ul').show();
$('#dhtml_menu-'+mId).unbind('click');
$('#dhtml_menu-'+mId).attr("href", "#");
});
</script>
#6
This would be a nice feature to have, but seeing as the menu tree is readily expandable by hand without requiring extra page-loads, having certain menus pre-expanded is not essential; so it's postponed for a while.
This feature could cause problems combined with the "leave only one item open at a time" feature, when multiple items are opened, but the D7 version already sanitizes contradictory options, so D6 could do so as well.
All in all, what is necessary here is a call to
variable_get('menu_expanded')in the dhtml_menu_theme_menu_item function (right next to the $_COOKIE part, I'd say).#7
Looks fairly easy. I'll patch just as soon as the rest of the D7 changes are done.
May be backported to D6 if it turns out to be as simple as it seems.
#8
thanks thtas... here is my version... The listed items are expanded by default. Then it will follow dhtml_menu cookie..
<script type="text/javascript">
$(document).ready(function(){
if(Drupal.dhtmlMenu.cookieGet() == "") {
var mId = new Array(350,1952,1953); //the menu id which will be expanded
for(var i in mId) {
$('#dhtml_menu-'+mId[i]).parent().removeClass('collapsed');
$('#dhtml_menu-'+mId[i]).parent().addClass('expanded');
$('#dhtml_menu-'+mId[i]).parent().children('ul').show();
}
Drupal.dhtmlMenu.cookieSet();
}
});
</script>
#9
It seems to be quite easy to solve: all we have to to in hook_init() (?) is pushing down the always-expanded mlid's to jQuery, and add a slightly modified version of #8's JS, which iterates through Drupal.settings.whatever, and not a burn-in constant array. If we want to be efficient, then we push down only the displayed always-expanded mlid's, and not all of them.
Should I prepare a patch (for d6), which does this?
#10
+1 for this feature simply because the Expanded attribute clearly says so ("If selected and this menu item has children, the menu will always appear expanded.") and DHTML Menu should honor that instead of creating a confusing user experience.
#11
This has been fixed in 6.x-4.x and 7.x-1.x.