My java-created HtmlAjaxCommandLink won't render rerender
juanignaciosl May 4, 2007 2:38 AMI'm trying to build a custom component composed mainly of two HtmlAjaxCommandLink.
This is a working a4j:commandLink:
<a4j:commandLink
actionListener='#{convocatoriaPaginadorBean.resetDataScroller}'
reRender="convocatoriasRiFa,convocatoriasRiFaScroller">
<a4j:actionparam name="sortBy" value="tituloAsc"
assignTo="#{convocatoriasPaginadorDataModel.filtro.orden.propiedadOrden}" />
<h:outputText value="#{msg.campo_titulo}" />
</a4j:commandLink>
And this is the code that I'm trying to replicate it with:
Application application = context.getCurrentInstance().getApplication();
HtmlAjaxCommandLink enlace = new HtmlAjaxCommandLink();
final String actionListener = (String) getValueBinding("actionListener").getExpressionString();
final Class[] params = new Class[]{ ActionEvent.class };
enlace.setActionListener(application.createMethodBinding(actionListener, params));
enlace.setReRender((String) getAttributes().get("reRender"));
/** AT THIS POINT ENLACE DOES HAVE THE PARAM ASSIGNED */
enlace.setId(((String) getAttributes().get("id"))+"enlace");
UIActionParameter actionParameter = new UIActionParameter();
actionParameter.setName("sortBy");
actionParameter.setValue((String) getAttributes().get("propiedad")+"Asc");
actionParameter.setAssignToBinding(getValueBinding("asignarA"));
enlace.getChildren().add(actionParameter);
UIOutput texto = new UIOutput();
texto.setValue((String) getValueBinding("texto").getValue(context));
enlace.getChildren().add(texto);
enlace.encodeBegin(context);
enlace.encodeChildren(context);
enlace.encodeEnd(context);
As I say at the code comment, reRender property is setted ("convocatoriasRiFa,convocatoriasRiFaScroller").
This is the output of the working link:
<a onclick="A4J.AJAX.Submit('_viewRoot','paginadorConvocatoriasForm',event,{'parameters':{'sortBy':'tituloAsc','paginadorConvocatoriasForm:convocatoriasRiFa:_idJsp7':'paginadorConvocatoriasForm:convocatoriasRiFa:_idJsp7'} ,'actionUrl':'/gnomos/convocatorias/verConvocatorias.jsf;jsessionid=55c6ccd99504bffffffffaf211589b6c84a1'} );return false;" name="paginadorConvocatoriasForm:convocatoriasRiFa:_idJsp7" id="paginadorConvocatoriasForm:convocatoriasRiFa:_idJsp7" href="#">Título</a>
Nevertheless, this is the output of the not working java link:
<a id="_idJsp10enlace" onclick="A4J.AJAX.Submit('_viewRoot',null,event,{'parameters':{'_idJsp10enlace':'_idJsp10enlace','sortBy':'tituloAsc'} ,'actionUrl':'/gnomos/convocatorias/verConvocatorias.jsf;jsessionid=55c6ccd99504bffffffffaf211589b6c84a1'} );return false;" name="_idJsp10enlace" href="#">Título</a>
As you can see, it doesn't have the reRerender ids.
What am I missing?