How to update a datalist in a form?
I'm trying to update a p:datalist
after user enters some informations to pop up. But i cant update partially my form.
Here is my .xhtml
<h:body>
<center>
<h:form style="width:500px">
<p:tabView>
<p:tab title="Profil">
<p:panel>
<h:panelGrid columns="2">
<p:dataList id="ortaklar" value="#{ortakController.ortakList}" var="ortak" type="ordered">
#{ortak.isim}, #{ortak.soyad}
</p:dataList>
</h:panelGrid>
</p:panel>
</p:tab>
<p:tab title="Detay"></p:tab>
<p:tab title="Kayıt"></p:tab>
</p:tabView>
</h:form>
<p:dialog header="Yeni Ortak" widgetVar="ortakDlg">
<h:form>
<h:panelGrid columns="2">
<h:outputText for="ortakIsim" value="İsim:" />
<h:inputText id="ortakIsim" value="#{ortakController.person.isim}" />
<h:outputText for="ortakSoyad" value="Soyad:" />
<h:inputText id="ortakSoyad" value="#{ortakController.person.soyad}" />
</h:panelGrid>
<p:commandButton value="Ekle" actionListener="#{ortakController.addToList}" update="ortaklar""/>
<p:commandButton id="sil" value="Sil" type="reset" />
</h:form>
</p:dialog>
</center>
</h:body>
Here is my bean;
@ManagedBean(name = "ortakController")
public class OrtakController {
private static List<Person> ortakList = new ArrayList<Person>();
private Person person = new Person();
public OrtakController() {
}
p开发者_JS百科ublic void addToList(ActionEvent actionEvent) {
ortakList.add(person);
}
public List<Person> getOrtakList() {
return ortakList;
}
public void setPerson(Person currentKisi) {
this.person = currentKisi;
}
public Person getPerson() {
return person;
}
}
Basically i added an item to pop up also i want to add this item to datalist in my form.
Any advice?
I removed tabView parent form. And it works. I think it is kind of a scope problem of forms.
精彩评论