从p:dataTable列表中选择并显示另一个p:dataTable列表的详细信息

时间:2013-12-06 16:30:57

标签: jsf jsf-2 primefaces

我有table来自list的{​​{1}}。当我单击其中一个bean时,我想查看另一个bean列表中的详细信息,我会将值写入第二个详细信息rows

假设我有datatable list名单bean名单,其中包含姓名,姓名和数字,当我点击一行时,在第二行datatable上有一个datatable bean list的{​​{1}},studentaddress

现在,当我点击学生表中的city但我无法在country上显示时,我可以System.out.print adress detail student

我问我如何将值设为rowdatatable中的值是多少? 谢谢你的帮助

datatable

datatable代码:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<h:body>
    <f:view>
        <h:form id="form">
            <p:dataTable id="users" var="user" value="#{userOS.osList}"
                paginator="true" rows="10" rowKey="#{user.kisiid}"
                selection="#{userOS.selectedOS}" selectionMode="single">
                <f:facet name="header">  
                                        Kullanıcı detaylarını görmek için view butonuna tıklayınız
                                        </f:facet>
                <p:ajax event="rowSelect" listener="#{userOS.onRowSelect}" update=":form:display"
                    oncomplete="userDialog" />

                <p:column headerText="Student No" sortBy="ogrencino"
                    filterBy="ogrencino" id="ogrencino">
                    <h:outputText value="#{user.ogrencino}" />
                    <f:param name="kid" value="#{userOS.osList.rowIndex}" />
                </p:column>

                <p:column headerText="Name" sortBy="ad" filterBy="ad" id="ad">
                    <h:outputText value="#{user.ad}" />
                </p:column>
                <p:column headerText="Surname" sortBy="soyad" filterBy="soyad"
                    id="soyad">
                    <h:outputText value="#{user.soyad}" />
                </p:column>
                <p:column headerText="Faculty" sortBy="altbirim.ad"
                    filterBy="altbirim.ad" id="altbirim">
                    <h:outputText value="#{user.altbirim.ad}" />
                </p:column>
                <p:column headerText="Department" sortBy="bolum.ad"
                    filterBy="bolum.ad" id="bolum">
                    <h:outputText value="#{user.bolum.ad}" />
                </p:column>
                <p:column headerText="Status" sortBy="ogrencidurum.ad"
                    filterBy="ogrencidurum.ad" id="ogrencidurum">
                    <h:outputText value="#{user.ogrencidurum.ad}" />
                </p:column>

                <f:facet name="footer">
                </f:facet>
            </p:dataTable>

            <p:panel id="dialog" header="User Detail" widgetVar="userDialog">

                <h:panelGrid id="panelgrid" columns="2" cellpadding="4">
                    <p:dataTable id="display" var="adres" value="#{userOS.adresList}">
                        <p:column headerText="Adres Tipi">
                            <h:outputText value="#{adres.AddressType}" />
                        </p:column>
                        <p:column headerText="Adres">
                            <h:outputText value="#{adres.Address}" />
                        </p:column>
                        <p:column headerText="İl">
                            <h:outputText value="#{adres.City}" />
                        </p:column>
                        <p:column headerText="Ülke">
                            <h:outputText value="#{adres.Country}" />
                        </p:column>
                    </p:dataTable>
                </h:panelGrid>

            </p:panel>


        </h:form>
    </f:view>
</h:body>
</html>

0 个答案:

没有答案