rich:dataTable builtin sort does not work
mabu2 Sep 21, 2012 5:08 AMHi,
I would like to have a table with 2 columns, the first colum should be sortable. So I wrote this xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<link href="styles/styles.css" rel="stylesheet" type="text/css" />
</h:head>
<h:body>
<f:loadBundle basename="afs.message" var="msg" />
<rich:dataTable value="#{userBean.allUserItems}" var="userentry" id="usertable" style="height:300px; width:300px;">
<rich:column sortable="true" sortBy="#{userentry.fullName}">
<f:facet name="header">
<h:outputText value="#{msg.lbl_name}" />
</f:facet>
<h:outputText value="#{userentry.fullName}" />
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="#{msg.lbl_id}" />
</f:facet>
<h:outputText value="#{userentry.id}" />
</rich:column>
</rich:dataTable>
</h:body>
</html>
This works well except the sort feature. Nothing happens when I click on the column header. The generated html is this:
<body>
<table id="usertable" class="rf-dt" style="height:300px; width:300px;">
<colgroup span="2"></colgroup>
<thead id="usertable:th" class="rf-dt-thd">
<tr id="usertable:ch" class="rf-dt-shdr">
<th class="rf-dt-shdr-c" scope="col" id="usertable:j_idt22">Name</th>
<th class="rf-dt-shdr-c" scope="col" id="usertable:j_idt9">ID</th>
</tr>
</thead>.....
So it is clear, that nothing happens, because there is no onclick attribute or any other element which could react to a mouse click. But why?
My environment:
- Tomcat 7.0.28 Java with JRE 1.6.0_30
- Eclipse Indigo
Thanks in advance
mabu2