早上好!我正在使用rich:extendedDataTable(JSF 1.2)并添加行,但是当我添加新行时,我删除了在其他行中键入的信息。我想知道是否有任何方法可以添加行而不删除我填写的数据?
按照以下代码
<a4j:commandButton value="Adicionar" reRender="gridList" action="#{managed$EvpessSessionBean.addPessoas}" ajaxSingle="true"/>
<rich:extendedDataTable height="480px" id="gridList" rows="15" selectionMode="single" value="#{managed$EvpessSessionBean.pessoasLista}" var="listPessoas" width="890px" >
<rich:column label="Codigo" width="50px">
<f:facet name="header">
<h:outputText value="Codigo"/>
</f:facet>
<h:outputText value="#{listPessoas.codpessoa}" />
</rich:column>
<rich:column label="Nome" width="290px">
<f:facet name="header">
<h:outputText value="Nome"/>
</f:facet>
<h:inputText value="#{listPessoas.nome}" style="width: 100%" onkeyup="this.value = this.value.toUpperCase();"/>
</rich:extendedDataTable>
<rich:datascroller align="center" for="gridList" id="sc2" maxPages="20"/>
“添加”按钮执行以下操作...
private List<Evpess> pessoasLista;
//Getter e Setter de pessoasLista...
public void addPessoas() {
Evpess p = new Evpess();
p.setCadacodigo(new Uccada());
p.setCodmovisocial(new Evmoso());
p.setEmprcod(new Eoempr(1));
pessoasLista.add(p);
}
您需要将您的dataTable内容提交给托管bean,因此可以保留这些值。将execute="gridList"
添加到你的a4j:commandButton
。