Question

I have a problem when generating a MegaMenu with primefaces 4.0, I have been testing the example of showcase, but is only applicable for normal menu, the MegaMenu has subMenu and column, if I put in the list if put into the column if it generates normal, but also have to do the dynamic subMenu.

<p:megaMenu autoDisplay="false" styleClass="menu-bar" model="#{mantClienteMB.model}" />

Code Java:

private void menuBean() {
    model = new DefaultMenuModel();

    //First submenu
    DefaultSubMenu firstSubmenu = new DefaultSubMenu("Dynamic Submenu");

    DefaultMenuItem item = new DefaultMenuItem("External");
    item.setUrl("http://www.primefaces.org");
    item.setIcon("ui-icon-home");
    firstSubmenu.addElement(item);

    model.addElement(firstSubmenu);

    //Second submenu
    DefaultSubMenu secondSubmenu = new DefaultSubMenu("Dynamic Actions");

    item = new DefaultMenuItem("Save");
    item.setIcon("ui-icon-disk");
    item.setCommand("#{mantClienteMB.save}");
    item.setUpdate("messages");
    secondSubmenu.addElement(item);

    item = new DefaultMenuItem("Delete");
    item.setIcon("ui-icon-close");
    item.setCommand("#{menuBean.delete}");
    item.setAjax(false);
    secondSubmenu.addElement(item);

    item = new DefaultMenuItem("Redirect");
    item.setIcon("ui-icon-search");
    item.setCommand("#{menuBean.redirect}");
    secondSubmenu.addElement(item);

    model.addElement(secondSubmenu); 
}

I show that if the code works, but it's not quite the dynamic MegaMenu.

<p:megaMenu autoDisplay="false" styleClass="menu-bar">
    <p:submenu label="Maintenance Services" icon="ui-icon-check">  
        <p:column>
            <p:menu model="#{mantClienteMB.model}" />
        </p:column>
    </p:submenu>
</p:megaMenu>

I show my screen error:

http://s2.subirimagenes.com/imagen/previo/thump_8726770menufailed.png

The display of what works.

http://s2.subirimagenes.com/imagen/previo/thump_8726772menuok.png

Was it helpful?

Solution

and found the solution to my problem in this forum, now only plays implement recursidad with BD.

http://forum.primefaces.org/viewtopic.php?f=3&t=35309

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top