a4j commandLink and in rich contextMenu
nswbity Mar 27, 2013 5:59 AMI must move a4j:commandLink from rich:datatable to rich:menuItem in rich:contextMenu.
Here the current code:
<rich:contextMenu attached="false" id="menu" submitMode="ajax"
oncollapse="row.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
<rich:menuItem ajaxSingle="true" rendered="true"
submitMode="ajax">
<a:commandLink
action="#{metadatiDocumentoController.visualizzaMetadati(idX)}"
status="waitingModalPanelStatus"
reRender="metadatiDocumentoPanel"
oncomplete="Richfaces.showModalPanel('metadatiDocumentoPanel')"
immediate="false">
<h:graphicImage value="/img/document-attribute-i.png"
title="#{messages['label.azioni.metadati']}" />
</a:commandLink>
</rich:menuItem>
</rich:contextMenu>
<a:outputPanel id="listaDocumentiPanel">
<rich:dataTable id="listaDocumenti"
rows="#{listaDocumentiController.documentiPerPagina}"
value="#{listaDocumentiController.documenti}" var="documento"
rowKeyVar="documentoKey"
onRowMouseOver="jQuery(this).addClass('tableRowMouseOver');"
onRowMouseOut="jQuery(this).removeClass('tableRowMouseOver');"
rendered="#{listaDocumentiController.documenti.size()!=0}"
onRowContextMenu="if (row) row.style.backgroundColor='#{a4jSkin.tableBackgroundColor}';
this.style.backgroundColor='#F1F1F1'; row=this; idDoc='#{documento.id}';
#{rich:component('menu')}.show(event,{id:'#{documento.id}', currentRow:'#{documentoKey}'});
return false;">>
....
<rich:column width="75px">
<a:commandLink
action="#{metadatiDocumentoController.visualizzaMetadati(documento.id)}"
status="waitingModalPanelStatus"
reRender="metadatiDocumentoPanel"
oncomplete="Richfaces.showModalPanel('metadatiDocumentoPanel')">
<h:graphicImage value="/img/document-attribute-i.png"
title="#{messages['label.azioni.metadati']}" />
</a:commandLink>
...
<rich:componentControl event="oncontextmenu" for="menu"
operation="show">
<f:param value="#{documento.id}" name="idX" />
</rich:componentControl>
</rich:dataTable>
</a:outputPanel>
</h:form>
The commandLink action works fine in rich:datable instead in the rich:menuItem parameter idX is always resolved to string empty in my backing bean.
Do you have any suggestions??