You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Thomas Chang <th...@yahoo.de> on 2007/03/02 15:03:14 UTC

Question about index-menu

Hi,

My web-Application has an index-menu on the left side. Assumed it has 2 top-levels and each top-lever has some under-level such as following:

TL1
  ul1-1
  ul1-2
TL2
  ul2-1
  ul2-2
  ul2-3

What I want is: at the beginning one can just see the top-level such as:
TL1
TL2

But if one click the TL1, the TL1 will open and it becomes as follow:
TL1
  ul1-1
  ul1-2
TL2

And if you click TL2 it will become:
TL1
TL2
  ul2-1
  ul2-2
  ul2-3

Can I do this mit JSF or should I do better it with CSS?

Regards

Thomas

 		
---------------------------------
Besseren Schutz gegen Spam - jetzt bei dem neuen Yahoo! Mail .

Re: Question about index-menu

Posted by Jeff Bischoff <jb...@klkurz.com>.
I disagree.

You don't need (custom) javascript for this. My application has a very 
similar menu.

When you are making NavigationMenuItems for e.g. PanelNavigation2, you 
can create a submenu like this:

// Create Security sub-menu
NavigationMenuItem security = new NavigationMenuItem("Security", null);
security.add(new NavigationMenuItem("Credentials", 
"#{navigation.menuGoCredentials}"));
security.add(new NavigationMenuItem("Group Policies", 
"#{navigation.menuGoGroupPolicies}"));
...
menu.add(security);

Then you can customize the appearance of sub-menus using CSS of the 
navigation list. Grab the CSS from myfaces example app as a starting 
point. That's what I did and got it to work great!

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Jörn Zaefferer wrote:
> That seems to be mostly a JavaScript requirement. I haven't combined it 
> with
> JSF yet, but basically it should work with any valid HTML:
> http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
> 
> For your requirement, you'd have to set the "unique"-option, eg.
> $("#mytree").Treeview({ unique: true });
> 
> If you haven't worked with jQuery or jQuery plugins yet, I have some links
> on the page, too: http://bassistance.de/jquery-plugins/
> 
> Let me know if this works for your, or if you need any help with the 
> plugin.
> 
> Regards
> Jörn
> 



Re: Question about index-menu

Posted by Jörn Zaefferer <jo...@googlemail.com>.
That seems to be mostly a JavaScript requirement. I haven't combined it with
JSF yet, but basically it should work with any valid HTML:
http://bassistance.de/jquery-plugins/jquery-plugin-treeview/

For your requirement, you'd have to set the "unique"-option, eg.
$("#mytree").Treeview({ unique: true });

If you haven't worked with jQuery or jQuery plugins yet, I have some links
on the page, too: http://bassistance.de/jquery-plugins/

Let me know if this works for your, or if you need any help with the plugin.

Regards
Jörn