Ajax Primefaces两个数据表更新并将数据从一个表添加到另一个表
在我的JSF页面中有两个DataTable,它们被放置在一个对话框中,在某个操作中弹出,这些dataTables包含来自托管bean中列表的数据,我试图做的是,当我双击第一个数据中的一行时,我想将其添加到第二个数据中,我已经实现了这一点,但只有当我关闭对话框并再次打开它时才会发生,我已经尝试使用ajax更新来更新我的第二个数据表,但问题仍然存在,我想在将第一个数据表移动到第二个数据表时隐藏第一个数据表中的数据,而不将其从列表中删除,或者(至少不允许用户移动同一项两次)有什么建议吗?这是我的对话框和数据表:Ajax Primefaces两个数据表更新并将数据从一个表添加到另一个表,ajax,jsf,primefaces,datatable,Ajax,Jsf,Primefaces,Datatable,在我的JSF页面中有两个DataTable,它们被放置在一个对话框中,在某个操作中弹出,这些dataTables包含来自托管bean中列表的数据,我试图做的是,当我双击第一个数据中的一行时,我想将其添加到第二个数据中,我已经实现了这一点,但只有当我关闭对话框并再次打开它时才会发生,我已经尝试使用ajax更新来更新我的第二个数据表,但问题仍然存在,我想在将第一个数据表移动到第二个数据表时隐藏第一个数据表中的数据,而不将其从列表中删除,或者(至少不允许用户移动同一项两次)有什么建议吗?这是我的对话框
<p:dialog modal="true" width="50%" height="50%" widgetVar="test"
id="dialog">
<p:dataTable id="tblAllQuestions" value="#{mbInstructor.fullList}"
var="asEmp" selectionMode="single"
selection="#{mbInstructor.currentExamQuestion}" rowKey="#{asEmp.id}"
rowIndexVar="rowIndex">
<p:ajax event="rowDblselect"
update="@parent:tblAllQuestions2"
process="@this" listener="#{mbInstructor.submitForm()}" />
<p:column headerText="#" width="20">
#{rowIndex+1}
</p:column>
<p:column headerText="#{msg2.get('employee')}" width="200">
#{asEmp.questionTxt}
</p:column>
</p:dataTable>
<p:dataTable id="tblAllQuestions2"
value="#{mbInstructor.formsQuestion}" var="as" selectionMode="single"
selection="#{mbInstructor.currentExamQuestion}" rowKey="#{as.id}"
rowIndexVar="rowIndex">
<p:ajax event="rowDblselect"
update="@parent:pnlfourmData"
process="@this" />
<p:column headerText="#" width="20">
#{rowIndex+1}
</p:column>
<p:column headerText="#{msg2.get('employee')}" width="200">
#{as.question.questionTxt}
</p:column>
</p:dataTable>
<h:outputText value="[no selection made]"
rendered="#{empty mbInstructor.model.target}" />
<p:commandButton id="formSubmit" value="Submit"
actionListener="#{mbInstructor.submitForm()}" style="margin-top:5px" />
</p:dialog>
但是对话框在完成时不会显示。将两个数据表放在一个表单中,并更新form@yagamiLight我试过了,但运气不好
oncomplete="PF('test').show()"