Panel menu item selected problem
jsfgeeks Apr 8, 2010 6:08 AMhi everyone
in my Application i am using Panel menu,panel menu group and panel menu item for listing list and sublist.
i have achived that dynamically through Java Class like below.
if (null == biomenu) {
biomenu = (HtmlPanelMenu) app.createComponent(HtmlPanelMenu.COMPONENT_TYPE);
}
HtmlPanelMenuGroup pnlgrpstd = (HtmlPanelMenuGroup) app.createComponent(HtmlPanelMenuGroup.COMPONENT_TYPE);
pnlgrpstd.setName(rs_tpview.getString("id"));
pnlgrpstd.setId("pnlmenugrp" + rs_tpview.getString("id"));
pnlgrpstd.setLabel(rs_tpview.getString("name"));
sel_chap = query;
rs2_tpview = stmt1_tpview.executeQuery(sel_chap);
if (con != null && rs2_tpview != null) {
while (rs2_tpview.next()) {
if (rs_tpview.isFirst() && rs2_tpview.isFirst()) {
current = rs2_tpview.getObject("id");
}
if (rs2_tpview.isFirst()) {
UIParameter pnlstdpara = (UIParameter) app.createComponent(UIParameter.COMPONENT_TYPE);
pnlstdpara.setId("pnlmenuitmfprmchap" + rs2_tpview.getString("id"));
pnlstdpara.setName("std_curr_1stchap");
pnlstdpara.setValue(rs2_tpview.getString("id"));
pnlgrpstd.getChildren().add(pnlstdpara);
}
HtmlPanelMenuItem phymenuitmchap = (HtmlPanelMenuItem) app.createComponent(HtmlPanelMenuItem.COMPONENT_TYPE);
phymenuitmchap.setLabel(rs2_tpview.getString("name"));
phymenuitmchap.setId("pnlmenuitm" + rs2_tpview.getString("id"));
phymenuitmchap.setName(rs2_tpview.getString("id"));
UIParameter pnlchappara = (UIParameter) app.createComponent(UIParameter.COMPONENT_TYPE);
pnlchappara.setId("pnlmenuitmfprm" + rs2_tpview.getString("id"));
pnlchappara.setName("current");
pnlchappara.setValue(rs2_tpview.getString("id"));
phymenuitmchap.getChildren().add(pnlchappara);
phymenuitmchap.setReRender("outpnl");
phymenuitmchap.setMode("ajax");
Class[] params = {};
MethodExpression actionExpression = app.getExpressionFactory().createMethodExpression(ctx.getELContext(), "#{contentlist.chapterlist_action}", String.class, params);
phymenuitmchap.setActionExpression(actionExpression);
phymenuitmchap.setReRender("outpnl");
pnlgrpstd.getChildren().add(phymenuitmchap);
}
}
Class[] params1 = {};
MethodExpression actionExpression1 = app.getExpressionFactory().createMethodExpression(ctx.getELContext(), "#{contentlist.std_action}", String.class, params1);
pnlgrpstd.setActionExpression(actionExpression1);
pnlgrpstd.setReRender("pnl_stdchaplst");
AjaxContext ac = AjaxContext.getCurrentInstance();
ac.addComponentToAjaxRender(biomenu);
pnlgrpstd.setExpandMode("ajax");
pnlgrpstd.setExpanded(true);
biomenu.getChildren().add(pnlgrpstd);
}
}
//jsp
<rich:simpleTogglePanel opened="#{contentlist.search_found==false}" rendered="#{contentlist.current_subject==1}" id="smpltglpnl_stdchaplst_bio" style="left:2px;top:35px;position:absolute;width:280px;height:725px;overflow:auto;" switchType="client" >
<f:facet name="header">
<h:outputText id="pnlbio_hd" value="#{rich:findComponent('btn_bio').value}"/>
</f:facet>
<h:outputText value="#{contentlist.current}"/>
<rich:panelMenu width="255px" selectedChild="#{contentlist.current}" expandSingle="true" binding="#{contentlist.biomenu}" id="biomenu" expandMode="ajax" iconExpandedTopGroup="chevronUp" iconCollapsedTopGroup="chevronDown">
</rich:panelMenu>
</rich:simpleTogglePanel>
I have three buttons and one dropdown for filter purpose so when one click on particular button Panel menu content changes.and first sublist(menu item) get highlighted,
but when i click on one of list(PanelMenuGroup) then it's first(sublist-panel menu item) won't get highlighted any idea?
like on above image i click on mechanics it's first value get selected!!!!!1