I have this code in xhtml
<p:menubar style="float:right; border: none; background-color: transparent; ">
<p:submenu label="#{bundlePantallas.txt_Acciones}" icon="ui-icon-gear" styleClass="botonVolver botonVolver:hover" style="right:12px">
<p:menuitem id="genInform" value="#{bundlePantallas.txt_GenerarInforme}" icon="ui-icon-disk" ajax="true" onclick="PrimeFaces.monitorDownload(start, stop);" update="growl" disabled="#{alumnoHAController.selected eq null}">
<p:fileDownload value="#{informesBean.informeAlumno()}"/>
</p:menuitem>
<p:menuitem value="#{bundlePantallas.EnviarCorreo}" icon="ui-icon-mail-closed" actionListener="#{menuController.abrirDialogoCorreo()}" update="growl"/>
</p:submenu>
// .... rest code ...
And I try that when I unselected a row on this datatable:
<p:dataTable id="datalist" widgetVar="datalistW" value="#{alumnoHAController.items}" var="item"
selectionMode="single" selection="#{alumnoHAController.selected}"
paginator="true" rowKey="#{item.idAlumno}" emptyMessage="#{bundlePantallas.texto_SinDatos}"
rowIndexVar="rowIndex" rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'dataTableFila1' : 'dataTableFila2'}"
rows="10" rowsPerPageTemplate="10,20,30,40,50">
<p:ajax event="rowSelect" update="createButton viewButton editButton deleteButton"/>
<p:ajax event="rowUnselect" update="createButton viewButton editButton deleteButton"/>
<p:column width="3%">
<p:rowToggler />
</p:column>
the menuItem will be disabled if I didn't select any column of the previous datatable.
I don't know where I forgot the update because the item to be disabled the first time when I enter to this page (bean.selected = null
in java code) but when I selected some one the menuitem remains disabled until that I entry in the view or edit button (on java code selected remains)