Ordenar dados em dataTable

pessoal, alguem tem uma solução pra como ordenar os dados de uma rich:dataTable clicanco no cabeçalho dela?

valeu desde já

No próprio richfaces já existe isso:

http://livedemo.exadel.com/richfaces-demo/richfaces/sortingFeature.jsf;jsessionid=3C8BF084B836AB313E3B103B546B4523?c=sorting

[quote=Gbzao!]No próprio richfaces já existe isso:

http://livedemo.exadel.com/richfaces-demo/richfaces/sortingFeature.jsf;jsessionid=3C8BF084B836AB313E3B103B546B4523?c=sorting[/quote]

E além de ordenar como nosso colega citou, tem também como fazer filtro.
É bem prático e legal, recomendo.

Olá pessoal,

estou fazendo conforme o link e mesmo assim o meu ocorre um problema. O unico detalhe é que um pedaço do xhtml usa o tomahawk… mas pelo que sei os 2 trabalham junto na boa

O “erro” que dá é estranho… ele só aparece no rodapé do IE o seguinte: Erro na pagina
Parece erro de javascript, mas não tenho nada de javascript no arquivo

alguem pode me ajudar, segue xhtml abaixo
vlw

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich" 
	template="/WEB-INF/layouts/layoutTemplate.xhtml">

	<ui:define name="mainContent">

		<h:form id="search">
			<t:htmlTag value="fieldset">
				<t:htmlTag value="legend">
					<t:outputText value="Parâmetros de busca" />
				</t:htmlTag>

				<t:panelGrid id="searchForm" columns="3" styleClass="form"
					columnClasses="label,">
					<t:outputLabel id="varietyLabel" for="varietyId" value="Variedade"
						title="Filtro baseado na variedade que deu origem ao lote de explantes" />
					<t:panelGroup>
						<t:selectOneMenu id="varietyMode" value="#{expList.varietyMode}">
							<f:selectItems value="#{expList.varietyModeItems}" />
						</t:selectOneMenu>
						<t:outputText value=" exibir lotes da variedade " />
					</t:panelGroup>
					<t:selectOneMenu id="varietyId" value="#{expList.varietyId}">
						<f:selectItem itemValue="#{varMap.invalidVarietyId}"
							itemLabel="qualquer" />
						<f:selectItems value="#{varMap.varietiesItems}" />
					</t:selectOneMenu>

					<t:outputLabel id="phaseLabel" for="phaseId" value="Fase"
						title="Filtro baseado na fase atual do lote de explantes" />
					<t:panelGroup>
						<t:selectOneMenu id="phaseMode" value="#{expList.phaseMode}">
							<f:selectItems value="#{expList.phaseModeItems}" />
						</t:selectOneMenu>
						<t:outputText value=" exibir lotes na fase " />
					</t:panelGroup>
					<t:selectOneMenu id="phaseId" value="#{expList.phaseId}">
						<f:selectItem itemValue="#{phaseMap.invalidExplantOpTypeId}"
							itemLabel="qualquer" />
						<f:selectItems value="#{phaseMap.phasesItems}" />
					</t:selectOneMenu>

					<t:outputLabel id="dateLabel" for="startDate" value="Data"
						title="Filtro baseado na data de entrada da fase atual do lote de explantes" />
					<t:outputText
						value="Mostrar lotes cuja mudança de fase se deu a partir de " />
					<t:panelGroup>
						<t:inputCalendar id="startDate" renderAsPopup="true"
							popupTodayString="Hoje é" popupTodayDateFormat="dd/MM/yyyy"
							renderPopupButtonAsImage="true" value="#{expList.startDate}" />
						<t:outputText value=" até " />
						<t:inputCalendar id="endDate" renderAsPopup="true"
							popupTodayString="Hoje é" popupTodayDateFormat="dd/MM/yyyy"
							renderPopupButtonAsImage="true" value="#{expList.endDate}" />
					</t:panelGroup>
					
					<t:outputLabel id="estadoLabel" for="ativo" value=" Mostrar lotes "
						title="Lotes" />
					<t:panelGroup>
						<t:selectOneMenu id="ativo" value="#{expList.estado}">
							<f:selectItem itemValue="-1" itemLabel="Todos" />
							<f:selectItems value="#{expList.estadosLote}" />
						</t:selectOneMenu>
					</t:panelGroup>
				</t:panelGrid>

				<t:commandButton id="submitSearchForm" styleClass="form"
					value="Buscar" action="Buscar" />
			</t:htmlTag>
		</h:form>


		<h:form id="main">
			<rich:dataTable id="searchResultTable" var="pb" sortMode="single"
				value="#{expList.palmBatches}"
				rendered="#{expList.palmBatches != null}" cellpadding="0"
				cellspacing="0" styleClass="data" rowClasses="oddRow, evenRow"
				headerClass="tableHeader">
				<rich:column id="varColumn" sortBy="#{varMap.varietiesMap[pb.varietyId].name}">
					<f:facet name="header">
							<h:outputText value="Variedade"/>
					</f:facet>
					<h:outputText value="#{varMap.varietiesMap[pb.varietyId].name}" />
				</rich:column>

				<rich:column id="phaseCol">
					<f:facet name="header">
						<h:outputText value="Fase"/>
					</f:facet>
					<h:outputText value="#{phaseMap.phasesMap[pb.phaseId].name}" />
				</rich:column>

				<rich:column id="phaseDateCol" sortBy="#{ pb.phaseDate }">
					<f:facet name="header">
		
							<h:outputText value="Data"/>
		
					</f:facet>
					<h:outputText value="#{ pb.phaseDate }" />
				</rich:column>

				<rich:column id="requestDate" >
					<f:facet name="header">
				
							<h:outputText value="Data de solicitação" />
					
					</f:facet>
					<h:outputText value="#{ pb.palmRequest.scheduleDate}" />
				</rich:column>

				<rich:column id="statusCol">
					<f:facet name="header">
						<h:outputText value="Status" />
					</f:facet>
					<h:outputText value="#{ pb.status }" />
				</rich:column>

				<rich:column id="actionCol">
					<f:facet name="header">
						<t:outputText value="Ações" />
					</f:facet>
					<t:commandLink value="descartar" action="DESCARTAR_LOTE_PALMITO" styleClass="linkBotao"
						rendered="#{pb.active and pb.availablePlates > 0}">
						<f:param name="palmBatchId" value="#{pb.palmBatchId}" />
					</t:commandLink>
					<t:commandLink value="entregar" action="DELIVER_PALM_BATCH" styleClass="linkBotao"
						rendered="#{!pb.delivered and pb.active}">
						<f:param name="palmBatchId" value="#{pb.palmBatchId}" />
					</t:commandLink>
					<t:commandLink value="multiplicar" action="SCHEDULE_MULTIPLICATION" styleClass="linkBotao"
						rendered="#{ !pb.scheduled and pb.phaseOrder >= 3 and 
                         pb.availablePlates > 0 and pb.active}">
						<f:param name="palmBatchId" value="#{pb.palmBatchId}" />
					</t:commandLink>
				</rich:column>

			</rich:dataTable>
		</h:form>

	</ui:define>
</ui:composition>