Jsf 选择一个panelGrid并设置对象

Jsf 选择一个panelGrid并设置对象,jsf,primefaces,Jsf,Primefaces,我有很多panelGrid,我想在单击panelGrid时打开一个对话框 始终在最后一个panelGrid中选择问题 index.xhtml <p:dataGrid var="object" value="#{vc.objects}" layout="grid" id="dataGridObject"> <h:panelGrid columns="1" onclick="rc()">

我有很多panelGrid,我想在单击panelGrid时打开一个对话框

始终在最后一个panelGrid中选择问题

index.xhtml

<p:dataGrid var="object" value="#{vc.objects}" 
layout="grid" id="dataGridObject">
    <h:panelGrid columns="1" onclick="rc()">                                                                                                              
        <h:outputText value="#{object.name} " />                                                                                                       
        <p:remoteCommand name="rc" update="formX" 
oncomplete="PF('dlgDetails').show()" action="#{vc.updateSelectObject(object)}"/>
    </h:panelGrid>
</p:dataGrid>

你为什么不试试另一种方法呢。在这种情况下,使用dataGrid,您可以用commandButton替换outputText和remoteCommand,并且可以将按钮的样式设置为类似于面板

    <p:dataGrid var="object" value="#{vc.objects}" 
     layout="grid" id="dataGridObject" columns="1">
     <p:commandButton value="#{object.name}" 
     actionListener="#{vc.updateSelectObject(object)}" process="@this"
     update="formX" oncomplete="PF('dlgDetails').show()" />
    </p:dataGrid>


检查您的源代码。看看有多少名为
rc()
的javascript函数。这是否回答了您的问题?库克杰,怎么办???我不明白。看到重复的,我是指客户端html源代码,对不起,我的问题是dataGrid,而不是datatable。。。使用datatable,我可以选择行。。
    <p:dataGrid var="object" value="#{vc.objects}" 
     layout="grid" id="dataGridObject" columns="1">
     <p:commandButton value="#{object.name}" 
     actionListener="#{vc.updateSelectObject(object)}" process="@this"
     update="formX" oncomplete="PF('dlgDetails').show()" />
    </p:dataGrid>