ReRendering Rows (Ajax Keys?)
israel.bgf Jun 17, 2009 8:44 AMI want to rerender the a row in a dataTable. The row that i want to reRender is the same one that have the button that triggers this reRender. I tried lot of different ways to do this, and it did not work, even using the ajaxKeys atribute (but i didnt understand it very well so it could be my fault). Anyway that's the code:
<a4j:form id="lista"> <rich:spacer height="10" /> <rich:datascroller for="dataTable" maxPages="20" binding="#{consultarComprovante.datascroller}" scrollerListener="#{consultarComprovante.scrollerListener}" id="scrollCategoria" /> <rich:dataTable id="dataTable" rendered="#{not empty consultarComprovante.lista}" value="#{consultarComprovante.lista}" var="item" rows="#{consultarComprovante.rows}" rowKeyVar="row" headerClass="data_table_header" border="0" styleClass="tabela_dados"> <rich:column> <a4j:commandButton value="#{tree.isOpen(row) ? '-' : '+'}" action="#{tree.change(row)}" ajaxSingle="true" reRender="lista" style="width:30px"/> </rich:column> <rich:column id="primeiraColuna"> <f:facet name="header"> Data </f:facet> <h:outputText value="#{item.data}" /> </rich:column> <rich:column> <f:facet name="header"> Quantidade </f:facet> <h:outputText value="#{item.quantidade}" /> </rich:column> <rich:column> <f:facet name="header"> Valor Total </f:facet> <h:outputText value="#{item.valorTotal}"> <f:convertNumber type="currency" currencySymbol="R$" groupingUsed="true" /> </h:outputText> </rich:column> <rich:subTable rendered="#{tree.isOpen(row)}" var="subitem" value="#{comprovanteBO.listarComprovantesPorData(item.data)}"> <rich:column> <f:facet name="header"> Valor </f:facet> <h:outputText value="#{subitem.valor}"> <f:convertNumber type="currency" currencySymbol="R$" groupingUsed="true" /> </h:outputText> </rich:column> <rich:column colspan="2"> <f:facet name="header"> Número Ponto de Venda </f:facet> <h:outputText value="#{subitem.lote.numeroPontoVenda}" /> </rich:column> <rich:column> <f:facet name="header"> Quantidade </f:facet> <h:outputText value="#{subitem.lote.descricaoEstabelecimento}" /> </rich:column> </rich:subTable> </rich:dataTable> </a4j:form>
I just want that the a4j:commandButton reRenders the subTable to show other registers about that register. I tried to surround the subTable with an a4j:outputPanel and reRender it, but it didn't work. The visual effect that i want to achieve is a dataTable row that can be "opened". How can i achieve this? The only way for now is reRendering all the table, but it's definitely a bad thing to do.