You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Birgit Kaschte <Bi...@netpioneer.de> on 2006/11/30 11:34:17 UTC

t:dataTable - sorting does not work for a4j:commandLink

Hi,

I read through many other posts, but unfortunately I could not find a
solution to my problem.
I've got a dataTable with 3 columns. Column 1 and 2 contain simple text
and column 3 contains 2 links (a4j:commandLink) - one to edit the data
of this row and one to delete this row. I have to set preserveDataModel
to true, because otherwise ajax doesn't work anymore.
The sorting works all fine for the text columns, but the third column
stays unchanged. So if I reverse the sorting and then try to edit the
top item, the data of the bottom item is shown (was at the top before
sorting). How can I solve this problem? I appreciate any help.

Here is my code so you can see what I mean:
<h:form id="chooseCategoryOverviewForm" styleClass="liste2">
<t:dataTable id="activeCategoryTable" 
             var="categorylist" 
             value="#{categoryManager.activeCategories}" 
             preserveDataModel="true" 
             rowClasses="zeile1,zeile2"
             sortColumn="#{categoryManager.sortColumn}" 
             sortAscending="#{categoryManager.sortAscending}" 
             preserveSort="true" 
             sortable="true">
  <t:column groupBy="false" defaultSorted="true"
sortPropertyName="name">
    <f:facet name="header">
      <t:commandSortHeader columnName="cName" arrow="true"
propertyName="name">
        <h:outputText value="#{txt.category_name}"/>
      </t:commandSortHeader>
    </f:facet>
    <h:outputText value="#{categorylist.name}" />
  </t:column>
  <t:column groupBy="false" style="width:200px"
sortPropertyName="description">
    <f:facet name="header">
      <t:commandSortHeader columnName="cDesc" arrow="true"
propertyName="description">
        <h:outputText value="#{txt.category_desc}"/>
      </t:commandSortHeader>
    </f:facet>
    <h:outputText value="#{categorylist.description}"/>
  </t:column>
  <t:column groupBy="false" style="background-color:#FFFFFF;border
0px;">
    <f:facet name="header">
      <t:commandSortHeader columnName="cButtons" arrow="false">
        <a4j:commandLink
action="#{categoryManager.newActiveCategory}"><h:graphicImage
url="/bilder/plus.gif" alt="#{txt.add}" title="#{txt.add}" width="16"
height="15" /></a4j:commandLink>
      </t:commandSortHeader>
    </f:facet>               		
    <a4j:commandLink action="edit-category"><t:updateActionListener
property="#{activeCategory}" value="#{categorylist}"/><h:graphicImage
url="/bilder/werkzeug.gif" alt="#{txt.edit}" title="#{txt.edit}"
width="18" height="15" /></a4j:commandLink>&#160;
    <a4j:commandLink reRender="categoryOverview"
action="#{categoryManager.removeActiveCategory}"><t:updateActionListener
property="#{activeCategory}" value="#{categorylist}"/><h:graphicImage
url="/bilder/minus.gif" alt="#{txt.delete}" title="#{txt.delete}"
width="16" height="15" /></a4j:commandLink>                  
  </t:column>
</t:dataTable>
</h:form>

--
Birgit Kaschte

Junior Developer
Netpioneer GmbH, Beiertheimer Allee 18, 76137 Karlsruhe

Tel: 0721 / 9 20 60 67
Fax: 0721 / 9 20 60 30
E-Mail: Birgit.Kaschte@netpioneer.de
www: http://www.netpioneer.de