Preserve previously selected row on rich:extendedDatatable after sort
kbhattac.mailto.kaushik.gmail.com Apr 25, 2010 2:19 PMHi,
I'm using a rich:extendedDataTable with sortable rich:column(s). If a row is selected and after that the table is sorted by a column, the row with the same row index remains selected, after the sort (instead of the previously selected row), which is wrong as the result set is now re-shuffled. Is this a bug of richfaces 3.3.1? Here is the used code snippet:
<rich:extendedDataTable width="428px" id="puvTable" border="0" rows="0" var="obj" value="#{allobjs}" style="border-bottom: 2px #FFF solid;table-layout:fixed;" height="340px" selection="#{tableWithFiltering.selection}" binding="#{tableWithFiltering.table}" cellpadding="0" cellspacing="0" selectionMode="single" selectedClass="objSelected" noDataLabel="Geen data" onkeydown="jQuery('.content *:input[type!=hidden]:first').attr('maxlength',5);"> <a4j:support event="onselectionchange" action="#{tableWithFiltering.select(OBJ_SELECT_EVENT)}" ajaxSingle="true" reRender="objs" oncomplete="reRenderBorder();"/> <a4j:support event="onkeyup" action="#{tableWithFiltering.filter(OBJ_SELECT_EVENT)}" ajaxSingle="true" reRender="objs" oncomplete="reRenderBorder();"/> <rich:column id="id" filterBy="#{obj.ID}" filterEvent="onkeyup" headerClass="text-column-indent" styleClass="text-column-indent" sortBy="#{obj.ID}" sortable="true" width="80" sortIconAscending="#{facesContext.externalContext.requestContextPath}/images/filterdown.gif" sortIconDescending="#{facesContext.externalContext.requestContextPath}/images/filterup.gif" sortIcon="#{facesContext.externalContext.requestContextPath}/images/filternone.gif"> <f:facet name="header"> <h:outputText styleClass="headerText" value="#{messages['beheren.obj.filter.id']}"/> </f:facet> <h:outputText value="#{obj.ID}"/> </rich:column> ... </rich:extendedDataTable>