0

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)

SilverNak
  • 3,283
  • 4
  • 28
  • 44
Raul Serra
  • 33
  • 7
  • 1
    You update a lot of id's in your ajax statement in the datatable, but non of them refers to the menuitem (genInform) or its root menubar, so when purely looking at this code, it is no wonder it is not updated – Kukeltje Sep 16 '17 at 16:25
  • Oh yes, I try it but the response of the iExplorer is: not found the element genInform ... – Raul Serra Sep 16 '17 at 16:27
  • 1
    Please mention these things directly!!! And is that the real response or your translation? https://stackoverflow.com/questions/8634156/how-to-find-out-client-id-of-component-for-ajax-update-render-cannot-find-compo and maybe you cannot update individual menuItems but you need to update the menubar (as sort of suggested in the other comment) – Kukeltje Sep 16 '17 at 16:44

0 Answers0