开发者

Why does event listener not get called?

I'm using ice:menuPopup to dynamically create menus on tree nodes. In jsf page I've something like this

  <f:facet name="content">
     <ice:panelGroup id="faccont" style="display: inline" menuPopup="qtaPupMenu"><ice:menuPopup imageDir="/images">
           <ice:menuItems  id="qtaPupMenu" value="#{item.userObject.menuModel}"/>
   . . .

Menu items are dynamically created by this code:

  public List<MenuItem> getMenuModel() {
    List<MenuItem> items = new LinkedList<MenuItem>();
    MenuItem mi = new MenuI开发者_运维百科tem();
    mi.setValue("menu text");    
    ExpressionFactory expf = FacesContext.getCurrentInstance().getApplication().getExpressionFactory();
    MethodExpression mthd = expf
    .createMethodExpression(FacesContext.getCurrentInstance().getELContext(), "#{beanmodel.clickMenuContx}", void.class, new Class[] { ActionEvent.class });
    mi.setActionExpression(mex);           
    items.add(mi);
    return items;
  }

The problem is that the event listener "#{beanmodel.clickMenuContx}" never gets called. I've tried also with methodBinding and setActionListener method of MenuItem, but doesn't work. Where am I going wrong?


Found it! It was missing the MenuItem id attribute. I added

   mi.setId("myUniqueId");

and it works as expected.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜