6 Replies Latest reply on Jan 11, 2010 6:33 PM by Daniel Tavares

    suggestionbox dynamically

    Daniel Tavares Newbie

      Hello.

       

      Im trying add a suggestionbox dynamically, but it does not work. I know this page: http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/faq/faq.html#d0e692, but  i think it need a update since the method setSuggestionAction does not accept MethodBinding. I think this is the problem in my code. See:

       

                HtmlSuggestionBox suggestions = new HtmlSuggestionBox();
                suggestions.setId(getId()+"_suggest");
                suggestions.setFor(getId()+"_ds");
                suggestions.setUsingSuggestObjects(true);
                suggestions.setSuggestionAction(createMethodExpression(
                                            "myBean.autocomplete", 
                                            ctx, 
                                            null ,new Class[]{java.lang.Object.class}));
                suggestions.setVar( "result" );
      
      ....// add columns and other things
      
      
           protected MethodExpression createMethodExpression(String expression, FacesContext ctx, Class<?> returnType, Class<?>[] parans){
                return ctx.getApplication().getExpressionFactory().createMethodExpression(
                                                                                                          ctx.getELContext(),
                                                                                                          "#{"+expression+"}", 
                                                                                                          returnType,
                                                                                                          parans);
      
           }
      
      

       

       

      What is wrong? i`ve noticed that some html representing the suggest was added, but the action neve is called.

       

      (ps: i already change the return type to List.class, in the methodexpression, but did not work too.)

       

      thanks!