How to dynamically add menu outside of menu items

2 views
Skip to first unread message

raydar

unread,
Apr 4, 2006, 9:50:12 PM4/4/06
to DOM Menu Library
I have a list of menu items from dom_menu_items. I need to dynamically
add other items based on a database. Any ideas?

Dan Allen

unread,
Oct 23, 2006, 8:23:29 AM10/23/06
to dom-...@googlegroups.com
The menu definition hash can be easily created dynamically or it can
be manipulated using the Hash object methods. However, once the menu
is drawn, it cannot easily be manipulated without scrapping it and
redrawing it.

To scrap the menu, simply run

document.getElementById('domMenu_main').innerHTML = '';
domMenu_activate('domMenu_main');

The menu definition can be manipulated, as in the following snippet,
which adds a third item to the first submenu.

domMenu_data.get('domMenu_main').get(1).set(3,
new Hash(
1,
new Hash(
'contents', 'New Item',
'uri', 'http://example.com'
)
)
);

It could be easier, I agree...perhaps creating a function that did the
nasty work would be the best way to handle it.

/dan

On 4/4/06, raydar <tom...@daugherty.com> wrote:
>
> I have a list of menu items from dom_menu_items. I need to dynamically
> add other items based on a database. Any ideas?
>
>
> >
>


--
Daniel Allen
Registered Linux User #231597

Mojavelinux.com: Open Source Advocacy
http://www.mojavelinux.com

While I make a strong effort to keep up with my email on a daily basis,
life and work come first and, at times, keep me away from my mail for a
while. If you contact me and then don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the filters. Please don't hesitate to resend a message if
you feel that it did not reach my attention.

Reply all
Reply to author
Forward
0 new messages