JSF Primefaces Ajax-update
Wie kann ich ein update für meine datatable per ajax Zeile wählen Sie Funktion?
Was wäre es, die Werte, die gesetzt werden, auf parameter update ?
vielen Dank für Ihre Hilfe
Hier ist mein code, es gibt ein datatable-und nachdem ich klicken Sie auf eine der Zeilen in der datatable dann zeigt das detail der Zeile in der Datentabelle unten, aber es gibt ein problem mit dem update
<?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" 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:tabView id="tabView">
<p:tab id="dialog" title="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}" id="adresturu"/>
</p:column>
<p:column headerText="Adres">
<h:outputText value="#{adres.address}" id="adres"/>
</p:column>
<p:column headerText="İl">
<h:outputText value="#{adres.city}" id="sehir"/>
</p:column>
<p:column headerText="Ülke">
<h:outputText value="#{adres.country}" id="ulke"/>
</p:column>
</p:dataTable>
</h:panelGrid>
</p:tab>
<p:tab id="tab2" title="Godfather Part II">
</p:tab>
<p:tab id="tab3" title="Godfather Part III">
</p:tab>
</p:tabView>
</h:form>
</f:view>
</h:body>
</html>
Du musst angemeldet sein, um einen Kommentar abzugeben.
Aktualisieren Sie den gesamten
@form
, in denen Sie halten beide DataTables.Also warum nicht aktualisieren Sie nur die zweite DataTable, wenn Sie eine Zeile auswählen in der Ersten DataTable.
Seit Ihrem zweiten Datatable in
p:tabView
so dauert es ID alstabView:display
.So Ihr
p:ajax
wäre:ODER
Können Sie die Zweite Tabelle in separate Table-und update-gesamte Formular.
Meine Erfahrung mit
p:tabView
halte ich nichtp:tabView
in form.Eher werde ich halten im inneren bilden
p:tabView
.Sehen Sie diesen Code: