1

我的 xhtml 看起来像这样:

 <p:dataTable
    rowKey="#{item.idMajor}"
    editable="true"
    selectionMode="single"
    value="#{majorController.beans}" 
    selection="#{majorController.selectedBean}"
    var="item"
    id="majorsTable"
    lazy="true"
    paginator="true"
    rows="5"
    rowsPerPageTemplate="5,10,15"       
    >
    <p:column headerText="Nazwa">
        <h:outputText value="#{item.nameAsEnum.toString()}"/>
    </p:column>
    <p:column headerText ="Symbol">
        <h:outputText value="#{item.symbolAsEnum.toString()}"/>
    </p:column>
    <p:ajax update=":form1:adminView:deleteMajorButton,
            :form1:adminView:editMajorButton,
            :form1:adminView:connectSubjectsButton"

            event="rowSelect"/>
    <p:ajax update=":form1:adminView:deleteMajorButton,
            :form1:adminView:editMajorButton,
            :form1:adminView:connectSubjectsButton" 

            event="rowUnselect"/>
</p:dataTable>
<p:commandButton    value="Nowy"
                    type="button" 
                    onclick="newMajorDlg.show()"
                    />
<p:commandButton value="Usuń"
                 actionListener="#{majorController.onClickDelete()}"
                 id="deleteMajorButton"
                 process="@this,majorsTable"
                 disabled="#{not majorController.itemSelected}"
                 update=":form1"/>
<p:commandButton value="Edytuj"
                 process="@this,majorsTable"
                 id="editMajorButton"
                 update=":form1:adminView:editMajorDialog"
                 disabled="#{not majorController.itemSelected}"
                 oncomplete="editMajorDlg.show()"/>
<p:commandButton value="Przypisz przedmioty"
                 actionListener="#{majorController.loadPickList()}"
                 id="connectSubjectsButton"
                 disabled="#{not majorController.itemSelected}"
                 process="@this,majorsTable"
                 update=":form1:adminView:subjectPickListDialog"
                 oncomplete="subjectPickDlg.show()"
                 />

当数据表中没有选择项目时,我尝试禁用按钮。禁用和启用按钮可以正常工作,但在启用连接到此按钮的按钮操作侦听器后不会触发。

感谢您在优势方面的帮助。

4

0 回答 0