a4j:support with f:setPropertyActionListener
campos Sep 30, 2011 3:28 PMHello,
In my xhtml code I have this code:
<rich:suggestion .... > <a4j:support event="onchange" immediate="true" ignoreDupResponses="true" eventsQueue="compQueue" requestDelay="500" limitToList="true" reRender="field" action="#{componentBean.findByKey}" ajaxSingle="true"> <f:setPropertyActionListener target="#{componentBean.valueId}" value="#{someOtherBean.valueId}" /> <!-- -99999 represents null value --> <a4j:actionparam noEscape="true" value="jQuery(this).val() == '' ? '-99999' : jQuery(this).val()" assignTo="#{componentBean.valueId}" /> </a4j:support> </rich:suggestion>
I need to create the suggestion via java wich would be like this:
HtmlSuggestionBox campoSuggestion = new HtmlSuggestionBox(); campoSuggestion.setId("sugg" + parametro.getNome()); campoSuggestion.setVar( "_var" + parametro.getNome() ); campoSuggestion.setWidth("350"); campoSuggestion.setHeight("300"); campoSuggestion.setFor( "desc" + parametro.getNome() ); campoSuggestion.setNothingLabel("Nenhum registro encontrado."); campoSuggestion.setFrequency(0.1); campoSuggestion.setMinChars("3"); campoSuggestion.setRequestDelay(600); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ELContext elCtx = context.getELContext(); MethodExpression me = expressionFactory.createMethodExpression(elCtx, "#{someBean.autoComplete}", List.class, new Class[]{Object.class}); campoSuggestion.setSuggestionAction(me); HtmlAjaxSupport a4jSuggestion = new HtmlAjaxSupport(); a4jSuggestion.setId( "a4jSugg" + campoSuggestion.getId() ); a4jSuggestion.setEvent("onchange"); a4jSuggestion.setLimitToList(true); a4jSuggestion.setAjaxSingle(true); a4jSuggestion.setRequestDelay(200); HtmlActionParameter param = new HtmlActionParameter(); param.setId("param"+campoSuggestion.getId()); param.setValue("jQuery(this).val() == '' ? '-99999' : jQuery(this).val()"); param.setName("suggACT"+parametro.getNome()); ValueExpression valorExpressparamSugg = expressionFactory .createValueExpression( elCtx, "#{someBean.paramComponentes['desc" + parametro.getNome() + "']}", String.class); param.setAssignToBinding(valorExpressparamSugg); a4jSuggestion.getChildren().add(param); //how to add f:setPropertyActionListener?????
Here I'm stuck, how can I add the f:setPropertyActionListener ??? Or something that works right exactly it ?!
Thanks in advance