Page 1 of 2

Dynamic po:menu with IDs

Posted: 17 Jan 2018, 00:24
by LGiusti84
Hi,

I've made a dynamic menu, but I found my self with a problem, I cannot set the IDs to the elements.
aragorn wrote:
21 Nov 2016, 09:07
I think this link can help to you for dynamic po:menu; http://www.primefaces.org/showcase/ui/menu/menu.xhtml (Please see Programmatic Menu section)
I used the example code suggested in the another post, but it was of no use.

----

This would be a quick representation of my code (actually tested)

xhtml:

Code: Select all

...
    <po:menu id="mainMenu" model="#{myBean.mainMenuModel}" />
...

Java bean:

Code: Select all

@ManagedBean
public class MyBean {

    private MenuModel model;

    @PostConstruct
    public void init() {
        model = new DefaultMenuModel();
        // model = new DynamicMenuModel(); // this option does not work either

        // Submenu
        DefaultSubMenu mySubmenu = new DefaultSubMenu("Dynamic Submenu");
        mySubmenu.setId("mySubmenu");

        DefaultMenuItem item = new DefaultMenuItem("External");
        item.setUrl("http://www.primefaces.org");
        item.setId("myMenuItem");
        mySubmenu.addElement(item);

        model.addElement(mySubmenu);
    }

    public MenuModel getMainMenuModel() {
        return model;
    }
}

this generates:

ul #mainMenu
....|__ il #mainMenu_0
........|__ ul
............|__ il #mainMenu_0_0

myMenuItem and mySubmenu are nowhere to be seen.

Re: Dynamic po:menu with IDs

Posted: 09 Feb 2018, 13:37
by mert.sincan
I think this issue is related to PrimeFaces core. Could you please try it with p:menu component without Omega Layout? We create unique ids for dynamic menu items in core.

Re: Dynamic po:menu with IDs

Posted: 15 Feb 2018, 20:03
by LGiusti84
I can confirm that, this is an issue of primefaces core. For what I read (here and on stackoverflow) this dates from primefaces 4 (almost 4,5 years ago?), even though we set the IDs with setId() method, they get overwritten with primefaces generated IDs (based on the menu id) when creating the code for rendering.

We've tried with dynamic menu items, default menu items and several other suggestions, ideas and so on, but since, moved on. We had adopted some bad-practices to avoid losing more time on this issue and continue with development and QA testing.


Again, did tested it some time ago with both p:menu and po:menu (with several combinations of defaultMenu*, DynamicMenu*, ..., and other ideas) and both failed to assign the given IDs.

Re: Dynamic po:menu with IDs

Posted: 21 Feb 2018, 10:01
by mert.sincan
Thanks a lot for the update. This is not a layout or theme issue. Please create an issue in core forum; viewforum.php?f=3

Best regards,

Re: Dynamic po:menu with IDs

Posted: 26 Feb 2018, 15:21
by LGiusti84
Since this is ongoing issue that dates several years I'd like to know, where should I ask for the refund?!?!??! (I have a paid layout/theme)
Have done it on their provided mail for support: contact@primetek.com.tr on the 2nd of Feb. and had no answer yet.
Also checked on PrimeStore, but no further contact information is provided.

Re: Dynamic po:menu with IDs

Posted: 01 Mar 2018, 09:07
by kubrasulukan
I'm afraid your situation does not fit our refund policy. Here is the link you can check out https://www.primefaces.org/layouts/refund

Best regards

Re: Dynamic po:menu with IDs

Posted: 13 Apr 2018, 17:40
by LGiusti84
The refund policies you send me to states:
Here are situations where a refund can be granted.

* Item is not same as in preview demos
* Item features are not as defined in descriptions
* Item does not function

As you can see there is a tag property for that element that does not works as it should, if you do not agree with me, plese
Tell me how to set the id of an element using the available method setId() created with such purpose with out being overwritten by primefaces

Since I'm asking for the above I might as well ask on
how to make a confirm dialog respect any of the attributes given when defined on the xhtml (eg.: closable, responsive, ...)

Re: Dynamic po:menu with IDs

Posted: 13 Apr 2018, 19:48
by LGiusti84
kubrasulukan wrote:
01 Mar 2018, 09:07
I'm afraid your situation does not fit our refund policy. Here is the link you can check out https://www.primefaces.org/layouts/refund

Best regards
This page takes you gave me has a contact url that points to a page that does not exists or is down.
Image

Re: Dynamic po:menu with IDs

Posted: 20 Apr 2018, 16:10
by LGiusti84
After almost 3 months with no answer, I received an email telling me that the refund was made.
I'll check in my credit card report at the end of the month.

Re: Dynamic po:menu with IDs

Posted: 22 Apr 2018, 20:41
by mert.sincan
Ok ;)