我在 UI 中使用 <p:datatable> 来使用 jsf 显示记录。我正在尝试单击“添加”按钮将行添加到数据表中。单击“添加”按钮时,我正在更新支持 bean 中的列表,这反过来又更新了 UI 中的数据表,并添加了额外的行。现在的问题是,我向数据表中添加的行越多,它变得越慢。任何相同的解决方案将不胜感激。
Below is my sample code -
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition template="#{dir}/template.xhtml" xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui">
<p:dataTable id="employeeTable" var="emp" value="#{bbean.employeeList}"
scrollable="true" scrollHeight="260" rowIndexVar="row">
<ui:include src="column1.xhtml" />
<ui:include src="column2.xhtml" />
<ui:include src="column3.xhtml" />
<ui:include src="column4.xhtml" />
<ui:include src="column5.xhtml" />
<ui:include src="column6.xhtml" />
<ui:include src="column7.xhtml" />
<ui:include src="column8.xhtml" />
<ui:include src="column9.xhtml" />
<ui:include src="column10.xhtml" />
<ui:include src="column11.xhtml" />
<ui:include src="column12.xhtml" />
<ui:include src="column13.xhtml" />
<ui:include src="column14.xhtml" />
<ui:include src="column15.xhtml" />
</p:dataTable>
<p:commandButton id="addButton" value="Add" process="@this"
actionListener="#{bbean.addEmployee}" oncomplete="DCVS.fn.focusOnTable('employeeTable')" />
</ui:composition>