I defined a p:datatable with sorting but when i try to sort a column nothing happens.
I'm using Primefaces 2.2 RC2, Mojarra 2.0.3 (FCS b03) an Jboss 5.1.0.GA
Thanks.
Giorgio
t1.xthml template
Code: Select all
<?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">
<html 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">
<f:view contentType="text/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/css/default.css" />
<link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/themes/#{loginBean.theme}/skin.css" />
<link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/css/syntaxhighlighter.css" />
<link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/css/icone.css" />
<style type="text/css">
.new {
background: url(../resources/images/new-ico.gif) no-repeat 1%;
}
.ui-widget {
font-size: 98% !important;
}
.ui-menu .ui-menu-item .ui-menu-item-label {
padding: .2em 1.7em;
}
.ui-growl {
top:115px;
}
.themeMenu {
overflow: auto;
height:300px;
width:200px;
}
</style>
<link rel="shortcut icon" href="#{request.contextPath}/favicon.ico" />
<title>E.A.Sy.Lab - Enhanced Automation System Laboratory</title>
</h:head>
<h:body>
<div id="top">
<ui:insert name="top">Top</ui:insert>
</div>
<div id="content" class="center_content">
<ui:insert name="content">Content</ui:insert>
</div>
<div id="bottom">
<ui:insert name="bottom">Bottom</ui:insert>
</div>
</h:body>
</f:view>
</html>
Code: Select all
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
template="./../template/t1.xhtml"
xmlns:p="http://primefaces.prime.com.tr/ui">
<ui:define name="top">
<ui:include src="./top.xhtml"/>
</ui:define>
<ui:define name="content">
<p:panel id="pannello">
<ui:include src="#{menuBarBean.includedPage}"/>
</p:panel>
</ui:define>
<ui:define name="bottom">
<ui:include src="./footer.xhtml"/>
</ui:define>
</ui:composition>
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:f="http://java.sun.com/jsf/core">
<body>
<h:form id="topForm">
<p:panel style="border: 0px;">
<p:graphicImage id="logo" value="./../resources/images/logo.png" />
<h:outputLabel value="#{loginBean.utente.riferimento}" style="font-weight: bold;"></h:outputLabel>
<h:outputLabel value="Ultimo accesso: #{loginBean.utente.ultimoAccesso}" style="font-weight: bold;"></h:outputLabel>
</p:panel>
<!-- MENU' -->
<p:growl id="menu"/>
<p:menubar effect="NONE" autoSubmenuDisplay="true">
<p:submenu label="File">
<p:menuitem value="Esci" ajax="false" action="#{loginBean.logout}"/>
</p:submenu>
<p:submenu label="Tabelle">
<p:menuitem id="menuUdM" value="Unità di misura" ajax="true" update="pannello" actionListener="#{menuBarBean.sideBarAction}">
<f:param id="menuUdmParam" name="pageViewId" value="udm" />
</p:menuitem>
</p:submenu>
</p:menubar>
</h:form>
</body>
</html>
Code: Select all
package it.artech.superlab.view;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.apache.log4j.Logger;
@ManagedBean
@ViewScoped
public class MenuBarBean implements Serializable {
private String includedPage = "";
public MenuBarBean() {
}
public void sideBarAction(ActionEvent actionEvent)
{
FacesContext context = FacesContext.getCurrentInstance();
String selectedPageViewId = context.getExternalContext().getRequestParameterMap().get("pageViewId");
if (selectedPageViewId.equalsIgnoreCase("udm"))
{
includedPage = "prova.xhtml";
}
}
public String getIncludedPage()
{
return includedPage;
}
public void setIncludedPage(String includedPage)
{
this.includedPage = includedPage;
}
}
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:f="http://java.sun.com/jsf/core">
<body>
<h:form id="testForm">
<h:head />
<h1><h:outputText value="List"/></h1>
<p:dataTable value="#{udmBean.listaUdm}" var="item"
selectionMode="single">
<p:column sortBy="#{item.idUnita}">
<f:facet name="header">
<h:outputText value="IdUnita"/>
</f:facet>
<h:outputText value="#{item.idUnita}"/>
</p:column>
<p:column sortBy="#{item.descrizione}">
<f:facet name="header">
<h:outputText value="Descrizione"/>
</f:facet>
<h:outputText value="#{item.descrizione}"/>
</p:column>
</p:dataTable>
</h:form>
</body>
</html>
Code: Select all
package it.artech.superlab.view;
import it.artech.superlab.ejb.entity.archivioanalisi.UnitaDiMisura;
import it.artech.superlab.ejb.session.client.local.GestioneArchivioAnalisiLocal;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import org.apache.log4j.Logger;
@ManagedBean(name="udmBean")
@RequestScoped
public class UnitaDiMisuraBean {
@EJB
private GestioneArchivioAnalisiLocal gestArchivio;
private final static Logger logger = Logger.getLogger(UnitaDiMisuraBean.class.getName());
List<UnitaDiMisura> listaUdm = new ArrayList<UnitaDiMisura>();
UnitaDiMisura udm;
/** Creates a new instance of UnitaDiMisuraBean */
public UnitaDiMisuraBean() {
}
public List<UnitaDiMisura> getListaUdm() {
listaUdm = gestArchivio.getElencoUnitaDiMisura();
return listaUdm;
}
public void setListaUdm(List<UnitaDiMisura> listaUdm) {
this.listaUdm = listaUdm;
}
public UnitaDiMisura getUdm() {
return udm;
}
public void setUdm(UnitaDiMisura udm) {
this.udm = udm;
}
}