jsf - Hide submenu if it has not children -
If I have a panel menu component and some of its submenu components do not show the child due to their children, on the wrong Set what can I do to hide the submenu option?
For example, submenu_1_2 and submenu_1_3 should be hidden: I do not need to use jQuery Step 2 Now find the component from the tree and if the car is present then set the rendered character false. Step 3. Then update the panel menu;
& lt; P: panel menu & gt; & Lt; P: submenu label = "submenu_1_1" & gt; & Lt; p: menu item = "# {backingBean.view_1_1_1}" value = "View_1_1_1" sang = "true" /> p: menu item = "# {backingBean.view_1_1_1}" value = "View_1_1_2" is provided = "true" /> & Lt; / P: submenu & gt; & Lt; P: submenu label = "submenu_1_2" & gt; & Lt; p: menu item = "# {backingBean.view_1_2_1}" value = "visible_1_2_1" is provided = "wrong" /> & Lt; / P: submenu & gt; & Lt; P: submenu label = "submenu_1_3" & gt; & Lt; p: menu item = "# {backingBean.view_1_3_1}" value = "visible_1_3_1" provided = "wrong" /> & Lt; p: menu item = "# {backingBean.view_1_3_2}" value = "visible_1_3_2" is provided = "false" /> & Lt; p: menu item = "# {backingBean.view_1_3_3}" value = "View_1_3_3" rendered = "false" /> & Lt; / P: submenu & gt; & Lt; / P: panelMenu & gt;
& lt; P: panelMenu id = "panelMenu" & gt; (UIComponent Component: FacesContext.getCurrentInstance (). GetViewRoot (). GetChildren ()) {if (component.getId (.) Contains ("panel menu")) {for (UIComponent panelMenuChild: component.getChildren ()) { // This is a child of the submenu panel menu (panel menu child .get childen (size). ()> Gt;) ((submenu) panel menu child) .set raider (wrong); }}}} RequestContext.getCurrentInstance () Update ("panelmenu");
Comments
Post a Comment