You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Klaus Schuster (JIRA)" <de...@myfaces.apache.org> on 2009/06/24 07:20:07 UTC

[jira] Created: (TOMAHAWK-1435) t:dataTable sorting Problem

t:dataTable sorting Problem
---------------------------

                 Key: TOMAHAWK-1435
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1435
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Data List
    Affects Versions: 1.1.8
            Reporter: Klaus Schuster


Hello, 
I am trying to use t:dataTable from Tomahawk to build a sortable table. The sort criteria (column which is used for sorting, asc vs. desc) should persist (in the session) so that when the use comes back to table after visiting other pages the same sort criteria should be automatically applied he used the last time. 
After perusing the API I thought this should be possible with these attributes. 
      
preserveDataModel="false"     
preserveSort="true"   
sortColumn="#{verein.sortColumn}"   
sortAscending="#{verein.ascending}">     


However I cannot make it work. The sorting criteria are stored in my backing bean, but when I navigate back to the table they are not applied. 

I am using tomahawk-1.1.8.jar on Websphere 6.1 

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"   
pageEncoding="ISO-8859-1"%>   
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>   
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>   
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">   
<html>   
<head>   
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">   
<link rel="stylesheet" type="text/css" href="styles.css" />   
    
<title>Insert title here</title>   
</head>   
<body>   
<f:view>   
<h:form id="f1">   
<t:dataTable value="#{verein.fechter}" var="fechter"   
rowClasses="oddRow,evenRow"     
preserveDataModel="false"     
preserveSort="true"   
sortColumn="#{verein.sortColumn}"   
sortAscending="#{verein.ascending}">   
<t:column sortable="true" defaultSorted="true">   
<f:facet name="header">   
<h:outputText value="Vorname" />   
</f:facet>   
<h:outputText value="#{fechter.vorname}" />   
</t:column>   
    
<t:column sortable="true" defaultSorted="true">   
<f:facet name="header">   
<h:outputText value="Nachname" />   
</f:facet>   
<h:outputText value="#{fechter.nachname}" />   
</t:column>   
<h:column headerClass="columnHeader">   
<f:facet name="header">   
<h:outputText value="Waffe" />   
</f:facet>   
<h:outputText value="#{fechter.waffe}" />   
</h:column>   
</t:dataTable>   
<h:commandButton value="OK" />   
</h:form>   
<a href="zweite.html">zweite Seite</a>   
</f:view>   
</body>   
</html>   
  

public class Verein {   
    
List<Fechter> fechter = new ArrayList<Fechter>();   
private int first = 1;   
private String sortColumn;   
private boolean ascending;   
  
public Verein() {   
  
fechter.add(new Fechter("Britta", "Blafasel", Waffe.De));   
fechter.add(new Fechter("Svenja", "Blubber", Waffe.Fl));   
fechter.add(new Fechter("Laura", "SSSSSS", Waffe.Fl));   
fechter.add(new Fechter("Lisa", "GGGGGG", Waffe.Fl));   
fechter.add(new Fechter("Anja", "FFFFF", Waffe.Fl));   
}   
    
public List<Fechter> getFechter() {   
return fechter;   
}   
    
public int getFirst() {   
return first;   
}   
    
public String getSortColumn() {   
return sortColumn;   
}   
    
public void setSortColumn(String sortColumn) {   
this.sortColumn = sortColumn;   
}   
    
public boolean isAscending() {   
return ascending;   
}   
    
public void setAscending(boolean ascending) {   
this.ascending = ascending;   
}   
  
  
}   
    

<faces-config   
    xmlns="http://java.sun.com/xml/ns/javaee"   
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee <a href="http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"" target="_blank" rel="nofollow">http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"</a>   
    version="1.2">   
        
    <managed-bean>   
    <managed-bean-name>verein</managed-bean-name>   
    <managed-bean-class>test.Verein</managed-bean-class>   
    <managed-bean-scope>session</managed-bean-scope>   
    </managed-bean>   
    
</faces-config>   
    


I would greatly appreciate any help 

Thanks,
Klaus 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.