如何更新表单中的数据列表?
我正在尝试在用户输入一些要弹出的信息后更新 p:datalist
。但我无法部分更新我的表格。
这是我的 .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>
这是我的 bean;
@ManagedBean(name = "ortakController")
public class OrtakController {
private static List<Person> ortakList = new ArrayList<Person>();
private Person person = new Person();
public OrtakController() {
}
public 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;
}
}
基本上我添加了一个要弹出的项目,我也想将此项目添加到我的表单中的数据列表中。
有什么建议吗?
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() {
}
public 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我删除了 tabView 父表单。它有效。我认为这是形式的范围问题。
I removed tabView parent form. And it works. I think it is kind of a scope problem of forms.