数据网格中的Primefaces命令按钮

数据网格中的Primefaces命令按钮,primefaces,Primefaces,我有一个datagrid,它的元素是一个面板和一些组件,包括一个commandbutton,我从bean加载数据,但是commandbutton的actionlistning即使在eclipse调试模式下也不会触发,因为它没有到达方法 <p:layout fullPage="true"> <p:layoutUnit header="Islands" position="west" closable="false" collapsed="false" collapsibl

我有一个datagrid,它的元素是一个面板和一些组件,包括一个commandbutton,我从bean加载数据,但是commandbutton的actionlistning即使在eclipse调试模式下也不会触发,因为它没有到达方法

<p:layout fullPage="true">
    <p:layoutUnit header="Islands" position="west" closable="false" collapsed="false" collapsible="true" size="180">
        <h:form>
        <p:toolbar>
            <f:facet name="left"><p:commandButton value="New island" icon="ui-icon-disk"></p:commandButton></f:facet>
        </p:toolbar>
        <p:dataGrid columns="1" value="#{empcreator.islands}" var="island">
            <p:panel header="#{island.name}" style="text-align:center">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton icon="ui-icon-disk"></p:commandButton>
                        <p:commandButton icon="ui-icon-trash"></p:commandButton>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton value="Load" actionListener="#{empcreator.loadIsland}"></p:commandButton>
                    </f:facet>
                </p:toolbar>
                <p:panelGrid columns="2">
                    <p:outputLabel value="ID"></p:outputLabel>
                    <p:outputLabel value="#{island.id}"></p:outputLabel>
                    <p:outputLabel value="X"></p:outputLabel>
                    <p:outputLabel value="#{island.x}"></p:outputLabel>
                    <p:outputLabel value="Y"></p:outputLabel>
                    <p:outputLabel value="#{island.y}"></p:outputLabel>
                    <p:outputLabel value="Model"></p:outputLabel>
                    <p:outputLabel value="#{island.model}"></p:outputLabel>                                                                             
                </p:panelGrid>  
            </p:panel>              
        </p:dataGrid>
        </h:form>
    </p:layoutUnit>
    <p:layoutUnit position="center" collapsed="false" collapsible="false" id="mainl" >
        <div id="cmain" style="padding:0px" onresize="onWindowResize"></div>
    </p:layoutUnit>
</p:layout>


这个问题与表单有关吗?

它应该从p:column嵌套,工作正常

您的字段中是否有bean验证
{island.id}
等?如果验证失败,则不会处理这些方法。还可以尝试将
actionListener
更改为
action
。当我从数据网格外部调用事件时,它会工作!