DataTable sort

I need to display a sortable dataTable. I look in some forums and find soemthings like this:
<h:dataTable sortable=true sortColumn="#{list.sort}" ...>
But in my environement, it is impossible to write "sortable" and "sortColumn" attributes:
"Atribute sortable invalid for tag dataTable according to TLD"
Environement:
- IDE=NetBeans 6.7.1
- Server=Glassfish v3 Prelude Domain
Any idea ?

.. and in Tomahawk datatable.
If you insist in using the RI datatable, or rather want the most effective method to page and sort a table in JSF, then check this article: [http://balusc.blogspot.com/2008/10/effective-datatable-paging-and-sorting.html].

Similar Messages

  • IceFaces 1.8 dataTable-sort example gives error

    Hi All:
    I need help, please!! Any help or hint is greatly appreciated it!!
    In the tutorial from IceFaces 1.8
    Data Table Component Tutorials
    I am using weblogic 10.3.2, IceFaces 1.8 and Jsf 1.2.
    I am using the jars that comes with the IceFaces 1.8 download.
    index.jsp:
    <html>
    <head>
    <title>ICEfaces Component Showcase</title>
    </head>
    <body>
    <jsp:forward page="sortableTable.iface" />
    </body>
    </html>
    sortableTable.jspx:
    <f:view xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ice="http://www.icesoft.com/icefaces/component">
    <ice:outputDeclaration doctypeRoot="HTML"
    doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN"
    doctypeSystem="http://www.w3.org/TR/html4/loose.dtd"/>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1"></meta>
    <title>DataTable Component Tutorial</title>
    <link href="./xmlhttp/css/xp/xp.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
    <h2>Sortable dataTable Component</h2>
    <p>In this example commandSortHeader components have been added to the
    table headers. Clicking on the headers will sort the table data.</p>
    <ice:form>
    <!--
    This is a very basic table comprising four columns. Each
    row represents an inventory item. Each column represents a
    inventory item property. commandSortHeader components have been
    added ot the table headers.
    The sortAscending and sortColumn attributes are set when a command
    sortColumnName header is activated. The sortColumn and sortAscending
    data can then be sortColumnName by a sortColumnName algorithm if a
    change is detected.
    -->
    <ice:dataTable
    id="dataSortData"
    sortColumn="#{inventoryList.sortColumnName}"
    sortAscending="#{inventoryList.ascending}"
    value="#{inventoryList.carInventory}"
    var="item">
    <!-- Stock number -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.stockColumnName}"
    arrow="true" >
    <ice:outputText value="#{inventoryList.stockColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.stock}"/>
    </ice:column>
    <!-- Model number -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.modelColumnName}"
    arrow="true" >
    <ice:outputText value="#{inventoryList.modelColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.model}"/>
    </ice:column>
    <!-- Description -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.descriptionColumnName} "
    arrow="true" >
    <ice:outputText value="#{inventoryList.descriptionColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.description}"/>
    </ice:column>
    <!-- Odometer reading -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.odometerColumnName}"
    arrow="true" >
    <ice:outputText value="#{inventoryList.odometerColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.odometer}"/>
    </ice:column>
    <!-- Price number -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.priceColumnName}"
    arrow="true" >
    <ice:outputText value="#{inventoryList.priceColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.price}"/>
    </ice:column>
    </ice:dataTable>
    </ice:form>
    </body>
    </html>
    </f:view>
    Error 500--Internal Server Error
    java.lang.Exception: javax.faces.FacesException: Can't parse stream for /index.jsp The prefix "jsp" for element "jsp:forward" is not bound.
    at com.icesoft.faces.context.View.servePage(View.java :152)
    at com.icesoft.faces.webapp.http.core.MultiViewServer .service(MultiViewServer.java:67)
    at com.icesoft.faces.webapp.http.common.ServerProxy.s ervice(ServerProxy.java:11)
    at com.icesoft.faces.webapp.http.servlet.MainSessionB oundServlet$4.service(MainSessionBoundServlet.java :149)
    at com.icesoft.faces.webapp.http.common.standard.Path DispatcherServer.service(PathDispatcherServer.java :24)
    at com.icesoft.faces.webapp.http.servlet.BasicAdaptin gServlet.service(BasicAdaptingServlet.java:16)
    at com.icesoft.faces.webapp.http.servlet.PathDispatch er.service(PathDispatcher.java:23)
    at com.icesoft.faces.webapp.http.servlet.SessionDispa tcher.service(SessionDispatcher.java:53)
    at com.icesoft.faces.webapp.http.servlet.PathDispatch er.service(PathDispatcher.java:23)
    at com.icesoft.faces.webapp.http.servlet.MainServlet. service(MainServlet.java:131)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:820)
    at weblogic.servlet.internal.StubSecurityHelper$Servl etServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invok eServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute( ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(Tail Filter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFi lter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$Ser vletInvocationAction.run(WebAppServletContext.java :3592)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.sec uredExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.exe cute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(S ervletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread. java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java :173)
    Caused by: javax.faces.FacesException: Can't parse stream for /index.jsp The prefix "jsp" for element "jsp:forward" is not bound.
    at com.icesoft.faces.application.D2DViewHandler.rende rResponse(D2DViewHandler.java:445)
    at com.icesoft.faces.application.D2DViewHandler.rende rView(D2DViewHandler.java:159)
    at com.sun.faces.lifecycle.RenderResponsePhase.execut e(RenderResponsePhase.java:110)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:1 00)
    at com.sun.faces.lifecycle.LifecycleImpl.render(Lifec ycleImpl.java:139)
    at com.icesoft.faces.webapp.http.core.JsfLifecycleExe cutor.apply(JsfLifecycleExecutor.java:19)
    at com.icesoft.faces.context.View$2$1.respond(View.ja va:48)
    at com.icesoft.faces.webapp.http.servlet.ServletReque stResponse.respondWith(ServletRequestResponse.java :201)
    at com.icesoft.faces.context.View$2.serve(View.java:7 7)
    at com.icesoft.faces.context.View.servePage(View.java :149)
    ... 25 more
    Caused by: org.xml.sax.SAXParseException: The prefix "jsp" for element "jsp:forward" is not bound.
    at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(AbstractSAXParser.java:1231)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserI mpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogic XMLReader.java:133)
    at weblogic.xml.jaxp.RegistryXMLReader.parse(Registry XMLReader.java:173)
    at org.apache.commons.digester.Digester.parse(Digeste r.java:1785)
    at com.icesoft.faces.webapp.parser.Parser.parse(Parse r.java:130)
    at com.icesoft.faces.application.D2DViewHandler.rende rResponse(D2DViewHandler.java:439)
    ... 34 more

    Hi All:
    I need help, please!! Any help or hint is greatly appreciated it!!
    In the tutorial from IceFaces 1.8
    Data Table Component Tutorials
    I am using weblogic 10.3.2, IceFaces 1.8 and Jsf 1.2.
    I am using the jars that comes with the IceFaces 1.8 download.
    index.jsp:
    <html>
    <head>
    <title>ICEfaces Component Showcase</title>
    </head>
    <body>
    <jsp:forward page="sortableTable.iface" />
    </body>
    </html>
    sortableTable.jspx:
    <f:view xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ice="http://www.icesoft.com/icefaces/component">
    <ice:outputDeclaration doctypeRoot="HTML"
    doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN"
    doctypeSystem="http://www.w3.org/TR/html4/loose.dtd"/>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1"></meta>
    <title>DataTable Component Tutorial</title>
    <link href="./xmlhttp/css/xp/xp.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
    <h2>Sortable dataTable Component</h2>
    <p>In this example commandSortHeader components have been added to the
    table headers. Clicking on the headers will sort the table data.</p>
    <ice:form>
    <!--
    This is a very basic table comprising four columns. Each
    row represents an inventory item. Each column represents a
    inventory item property. commandSortHeader components have been
    added ot the table headers.
    The sortAscending and sortColumn attributes are set when a command
    sortColumnName header is activated. The sortColumn and sortAscending
    data can then be sortColumnName by a sortColumnName algorithm if a
    change is detected.
    -->
    <ice:dataTable
    id="dataSortData"
    sortColumn="#{inventoryList.sortColumnName}"
    sortAscending="#{inventoryList.ascending}"
    value="#{inventoryList.carInventory}"
    var="item">
    <!-- Stock number -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.stockColumnName}"
    arrow="true" >
    <ice:outputText value="#{inventoryList.stockColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.stock}"/>
    </ice:column>
    <!-- Model number -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.modelColumnName}"
    arrow="true" >
    <ice:outputText value="#{inventoryList.modelColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.model}"/>
    </ice:column>
    <!-- Description -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.descriptionColumnName} "
    arrow="true" >
    <ice:outputText value="#{inventoryList.descriptionColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.description}"/>
    </ice:column>
    <!-- Odometer reading -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.odometerColumnName}"
    arrow="true" >
    <ice:outputText value="#{inventoryList.odometerColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.odometer}"/>
    </ice:column>
    <!-- Price number -->
    <ice:column>
    <f:facet name="header">
    <ice:commandSortHeader
    columnName="#{inventoryList.priceColumnName}"
    arrow="true" >
    <ice:outputText value="#{inventoryList.priceColumnName}"/>
    </ice:commandSortHeader>
    </f:facet>
    <ice:outputText value="#{item.price}"/>
    </ice:column>
    </ice:dataTable>
    </ice:form>
    </body>
    </html>
    </f:view>
    Error 500--Internal Server Error
    java.lang.Exception: javax.faces.FacesException: Can't parse stream for /index.jsp The prefix "jsp" for element "jsp:forward" is not bound.
    at com.icesoft.faces.context.View.servePage(View.java :152)
    at com.icesoft.faces.webapp.http.core.MultiViewServer .service(MultiViewServer.java:67)
    at com.icesoft.faces.webapp.http.common.ServerProxy.s ervice(ServerProxy.java:11)
    at com.icesoft.faces.webapp.http.servlet.MainSessionB oundServlet$4.service(MainSessionBoundServlet.java :149)
    at com.icesoft.faces.webapp.http.common.standard.Path DispatcherServer.service(PathDispatcherServer.java :24)
    at com.icesoft.faces.webapp.http.servlet.BasicAdaptin gServlet.service(BasicAdaptingServlet.java:16)
    at com.icesoft.faces.webapp.http.servlet.PathDispatch er.service(PathDispatcher.java:23)
    at com.icesoft.faces.webapp.http.servlet.SessionDispa tcher.service(SessionDispatcher.java:53)
    at com.icesoft.faces.webapp.http.servlet.PathDispatch er.service(PathDispatcher.java:23)
    at com.icesoft.faces.webapp.http.servlet.MainServlet. service(MainServlet.java:131)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:820)
    at weblogic.servlet.internal.StubSecurityHelper$Servl etServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invok eServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute( ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(Tail Filter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFi lter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$Ser vletInvocationAction.run(WebAppServletContext.java :3592)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.sec uredExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.exe cute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(S ervletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread. java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java :173)
    Caused by: javax.faces.FacesException: Can't parse stream for /index.jsp The prefix "jsp" for element "jsp:forward" is not bound.
    at com.icesoft.faces.application.D2DViewHandler.rende rResponse(D2DViewHandler.java:445)
    at com.icesoft.faces.application.D2DViewHandler.rende rView(D2DViewHandler.java:159)
    at com.sun.faces.lifecycle.RenderResponsePhase.execut e(RenderResponsePhase.java:110)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:1 00)
    at com.sun.faces.lifecycle.LifecycleImpl.render(Lifec ycleImpl.java:139)
    at com.icesoft.faces.webapp.http.core.JsfLifecycleExe cutor.apply(JsfLifecycleExecutor.java:19)
    at com.icesoft.faces.context.View$2$1.respond(View.ja va:48)
    at com.icesoft.faces.webapp.http.servlet.ServletReque stResponse.respondWith(ServletRequestResponse.java :201)
    at com.icesoft.faces.context.View$2.serve(View.java:7 7)
    at com.icesoft.faces.context.View.servePage(View.java :149)
    ... 25 more
    Caused by: org.xml.sax.SAXParseException: The prefix "jsp" for element "jsp:forward" is not bound.
    at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(AbstractSAXParser.java:1231)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserI mpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogic XMLReader.java:133)
    at weblogic.xml.jaxp.RegistryXMLReader.parse(Registry XMLReader.java:173)
    at org.apache.commons.digester.Digester.parse(Digeste r.java:1785)
    at com.icesoft.faces.webapp.parser.Parser.parse(Parse r.java:130)
    at com.icesoft.faces.application.D2DViewHandler.rende rResponse(D2DViewHandler.java:439)
    ... 34 more

  • Jsf dataTable sort

    Hi all,
    How can the contents of dataTable component be sorted, tomahawk dataTable component provides a commandSortHeader how to use this, can any one show an example on how to write the sort handler ?
    Thanks in advance

    I think that the examples should have the source. Unfortunatly don't. I've decompiled the code, and i post here what you need:
    package org.apache.myfaces.examples.listexample;
    public abstract class SortableList
    protected SortableList(String defaultSortColumn)
    _sort = defaultSortColumn;
    _ascending = isDefaultAscending(defaultSortColumn);
    protected abstract void sort(String s, boolean flag);
    protected abstract boolean isDefaultAscending(String s);
    public void sort(String sortColumn)
    if(sortColumn == null)
    throw new IllegalArgumentException("Argument sortColumn must not be null.");
    if(_sort.equals(sortColumn))
    ascending = !ascending;
    } else
    _sort = sortColumn;
    ascending = isDefaultAscending(sort);
    sort(_sort, _ascending);
    public String getSort()
    return _sort;
    public void setSort(String sort)
    _sort = sort;
    public boolean isAscending()
    return _ascending;
    public void setAscending(boolean ascending)
    _ascending = ascending;
    private String _sort;
    private boolean _ascending;
    package org.apache.myfaces.examples.listexample;
    import java.util.*;
    // Referenced classes of package org.apache.myfaces.examples.listexample:
    // SortableList, SimpleCar
    public class SimpleSortableCarList extends SortableList
    public SimpleSortableCarList()
    super("type");
    _cars = new ArrayList();
    _cars.add(new SimpleCar(1, "car A", "red"));
    _cars.add(new SimpleCar(1, "car B", "blue"));
    _cars.add(new SimpleCar(1, "car C", "green"));
    _cars.add(new SimpleCar(1, "car D", "yellow"));
    _cars.add(new SimpleCar(1, "car E", "orange"));
    public List getCars()
    sort(getSort(), isAscending());
    return _cars;
    protected boolean isDefaultAscending(String sortColumn)
    return true;
    protected void sort(final String column, final boolean ascending)
    Comparator comparator = new Comparator() {
    public int compare(Object o1, Object o2)
    SimpleCar c1 = (SimpleCar)o1;
    SimpleCar c2 = (SimpleCar)o2;
    if(column == null)
    return 0;
    if(column.equals("type"))
    return ascending ? c1.getType().compareTo(c2.getType()) : c2.getType().compareTo(c1.getType());
    if(column.equals("color"))
    return ascending ? c1.getColor().compareTo(c2.getColor()) : c2.getColor().compareTo(c1.getColor());
    else
    return 0;
    Collections.sort(_cars, comparator);
    private List _cars;
    The code was decompiled with:
    // Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://www.kpdus.com/jad.html

  • (Tomahawk) DataTable sort question

    Hello,
    I'm showing the system properties on a webpage. The backing bean simply returns a list of entries (java.util.Map.Entry) which are shown by a t:datatable (backing bean has request scope).
    So now that they are there, I'd like to have them sorted one way or another. I don't know how to use the sortColumn attribute in this case, perhaps I'll need to sort them in the backing bean instead?
    Thanks,
    Dave

    Hi!
    you dont need to stor in the been.
    you can do it in the jsp page like this: (using DataTable from RichFaces)
    <rich:extendedDataTable  sortPriority="#{spot.startTimeForTable}"
                   value="#{scheduleResultBean.lspotsOnDate}" var="spot" id="spots"
                   rowClasses="#{spot.statusName}" >
                   <rich:column sortBy="#{spot.rating}" filterBy="#{spot.rating}"
                        filterEvent="onkeyup" label="Rating" >
                        <f:facet name="header">
                             <h:outputText value="Rating" />
                        </f:facet>
                        <h:outputText value="#{spot.rating}">
                        </h:outputText>
                   </rich:column>
    </rich:extendedDataTable>I'd like to hear if it helped you to!

  • X:dataTable sort arrow rendered as question mark (?)

    Hey All:
    I am using tomahawk 1.1.3 and when I use sortable columns with x:dataTable, the sort arrows are being rendered as question marks (?). Any ideas?

    were would be the place to find the original system install CD.
    Ideally, your friend:
    My Friend gave me his Old Imac G5
    The Apple Store may have original system install discs but I would be surprised since no Apple Store in the US that I know of sells them any longer.
    It will not be free, but if they have one that would be the best option. Otherwise you will have to peruse the used market. In the US that could be Amazon Marketplace or eBay. I do not know where you would start in India, but many eBay sellers ship worldwide.
    Make absolutely certain you are getting a full retail installation CD and if it is Leopard or Tiger, make sure it is for your G5 and not an Intel iMac. System specific disks are grey in color and will not work except for the exact system with which they were included.

  • AJAX: Datatable sorting using a4j:commandLink

    Hi,
    I have been using h:commandLink to sort data-table and display UP or DOWN arrow in JSF. But, when i moved to ajax-based, a4j:commandLink to sort by data-table, sort is not happening at all.
    I am attaching code for a single <h:column>
    <h:column id="c1">
    <f:facet name="header">
    <a4j:commandLink id="i21"
    action="#{bean.sortByDate}"
    reRender="suspList1">
    <h:outputText id="i22" value="#{msg.date}" />
    <%
    if(objbean != null && objbean.isSortColumn(Constants.SORT_BY_DATE)) {
    if(objbean != null && objbean.isListAscending()) {
    %>
    <f:verbatim>
    <img id="image1" border="0" src="img/arrowup.gif">
    </img>
    </f:verbatim>
    <%
    } else {
    %>
    <f:verbatim>
    <img id="image2" border="0" src="img/arrowdown.gif">
    </img>
    </f:verbatim>
    <%
    %>
    </a4j:commandLink>
    </f:facet>
    <h:outputText id="i23" value="#{Item.runDate}" styleClass="left">
    <f:convertDateTime pattern="MM/dd/yyyy" />
    </h:outputText>
    </h:column>
    can you please help?
    Thanks

    SureshScreen wrote:
    IMMTLY ASAP.After reading this my motivation to give an helpful answer went from 60% to 0%.
    [Please ask questions the smart way|http://www.catb.org/~esr/faqs/smart-questions.html].

  • Paging datatable after sort

    First i populate a datatable with no error then i used a commandlink to sort through the list. The new list came out to be fine but the problem i am facing is that my jsp page display the data of the same page index before the sort. For example, before the sort i am viewing page 3. Then after i click the sort, the data is rearranged and will display the new data that is currently positioned in page 3, but i want it to start at page 1. Furthermore, the commandbutton to navigate through the pages no longer work. I think this is due to the lifecycele of JSF. Can someone give me some in sight on how to fix this. Here is the sample of my code.
    Bean:
    public void populateDynamicDataTable() {
    // Any columns?
    if (myList != null && myList.size() > 0) {
         dynamicDataTable = new HtmlDataTable();
    // Get amount of columns.
    int columns = ((List) myList.get(0)).size();
    // Set columns.
    for (int i = 0; i < columns; i++) {
    // Set header (optional).
    HtmlCommandLink button = new HtmlCommandLink();
    MethodBinding actionListener =
    FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{viewLog.testListener}", new Class[] {ActionEvent.class});
    button.setActionListener(actionListener);
    button.setValue(headers);
    button.setStyle("color:white");
    // Set output.
    UIOutput output = new UIOutput();
    ValueBinding myItem =
    FacesContext.getCurrentInstance().getApplication()
    .createValueBinding("#{myItem[" + i + "]}");
    output.setValueBinding("value", myItem);
    // Set column.
    UIColumn column = new UIColumn();
    column.setHeader(button);
    column.getChildren().add(output);
    // Add column.
    dynamicDataTable.getChildren().add(column);
    dynamicDataTable.setRows(5);
    public void testListener(ActionEvent e) throws AbortProcessingException {
              System.out.println("hellow rold");
              String hei = ((UICommand) e.getComponent()).getValue().toString();
              dbTools = new DbTools();
    Connection con=null;
    try {
                   con = dbTools.getConnection();
                   String que = "SELECT * FROM ATTRIBUTE_VALUE_CHANGELOG where submitter_id = '2995' order by attribute_id" ;
                        ResultSet results=con.prepareStatement(que).executeQuery();
                        int size =0;
                        List myID = new ArrayList();
                        List type = new ArrayList();
                        List typeID = new ArrayList();
                        List attributeID = new ArrayList();
                        List submitter = new ArrayList();
                        List date = new ArrayList();
                        List valueOld = new ArrayList();
                        List valueNew = new ArrayList();
                        while(results.next()){
                             myID.add(results.getString(1));
                             type.add(results.getString(4));
                             typeID.add(results.getString(5));
                             attributeID.add(results.getString(6));
                             submitter.add(results.getString(7));
                             date.add(results.getString(8));
                             valueOld.add(results.getString(9));
                             valueNew.add(results.getString(10));
                        System.out.println("size of: " + myID.size());
                        headers = new String[] { "header1", "header2", "header3", "header4", "header5", "header6", "header7", "header8" };
                        myList = new ArrayList();
                        for(int i =0; i<valueNew.size(); i++){
                             String[] row = {myID.get(i).toString(),
                                            type.get(i).toString(),
                                            typeID.get(i).toString(),
                                            attributeID.get(i).toString(),
                                            submitter.get(i).toString(),
                                            date.get(i).toString(),
                                            valueOld.get(i).toString(),
                                            valueNew.get(i).toString()};
                        myList.add(Arrays.asList(row));
                        dbTools.close(con);
              } catch (SQLException ex) {
                   System.out.println("error here");
                   ex.printStackTrace();
              populateDynamicDataTable();
              //dynamicDataTable.setRows(0);
         public void pageFirst() {
                   dynamicDataTable.setFirst(0);
         public void pagePrevious() {
              dynamicDataTable.setFirst(dynamicDataTable.getFirst() - dynamicDataTable.getRows());
         public void pageNext() {
              dynamicDataTable.setFirst(dynamicDataTable.getFirst() + dynamicDataTable.getRows());
         public void pageLast() {
         int count = dynamicDataTable.getRowCount();
         int rows = dynamicDataTable.getRows();
         dynamicDataTable.setFirst(count - ((count % rows != 0) ? count % rows : rows));
    JSP:
         <h:dataTable value="#{viewLog.myList}" var="myItem" binding="#{viewLog.dynamicDataTable}" />
                             <h:panelGroup>
                                       <h:commandButton value="first" action="#{viewLog.pageFirst}" disabled="#{viewLog.dynamicDataTable.first == 0}" />
                                       <h:commandButton value="prev" action="#{viewLog.pagePrevious}" disabled="#{viewLog.dynamicDataTable.first == 0}" />
                                       <h:commandButton value="next" action="#{viewLog.pageNext}" disabled="#{viewLog.dynamicDataTable.first + viewLog.dynamicDataTable.rows >= viewLog.dynamicDataTable.rowCount}" />
                                       <h:commandButton value="last" action="#{viewLog.pageLast}" disabled="#{viewLog.dynamicDataTable.first + viewLog.dynamicDataTable.rows >= viewLog.dynamicDataTable.rowCount}" />
                             </h:panelGroup>

    I have tried adding dynamicDataTable.setFirst(0) at the end of the testListener method where i invoke the sort. The list gets sorted, however, the navigation button gets disabled still

  • Sorting datatable based on column

    Hi,
    I am new to java studio creator and java. I am trying to sort the datatable based on a column using the methods given in previous posts which uses a button in the column header. I am trying to implement the same method but getting an error when using dataTable1Model.execute().
    My code is
    public String button1_action() {
    // TODO: Process the button click action. Return value is a navigation
    // case name where null will return to the same page.
    // SesssionBean1.tbl_sde_helpRowSet1
    getSessionBean1().getTbl_sde_helpRowSet().setCommand("select * from tblSample order by tblSample.serial_no");
    // getDataTable1Model()
    dataTable1Model.execute();
    return null;
    The error i am getting is
    Cannot find symbol
    symbol:method execute()
    location: class com.sun.jsfcl.data.CachedRowSetDataModel
    Please help me solve this.
    Thanks,
    Sru

    Hi,
    Thanks for the reply John. I tried using the Table component. But the problem I am facing with using that is I am not able to add scroll bars to it. I tried using the table component inside group panel just like using dataTable component inside group panel to get scroll bars. But didnt work. Any idea on how to add scroll bars to the table.
    Thanks,
    Sru

  • Sorting in dataTable

    If anyone had played with display arena .. plss plss let me know ..
    can we do sorting in dataTable .. i dont see any tags attributes around ..
    if its not at all possible in jsp , then only i can get in bean coding side ..

    use bean coding style :)

  • Automatic Sort on dataTable affects other tables

    Hi everybody,
    I'm struggling a little bit with JSF as I have a special requirement - I need a dynamic display of some independently sortable dataTables below each other.
    It works quite well, but the problem is, that if I sort one of the shown tables, it affects the other tables as well.
    Hav a look on my page content:
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <f:view>
    <html>
    <body>
    <h:form id="frm">
         <t:dataList value="#{bean.tablelist}" var="table">
                   <t:dataTable value="#{table.data}" var="tablerow"
                             width="500" border="1"
                             sortable="true" sortColumn="#{table.sortColumn}"
                             sortAscending="#{table.sortAscending}"
                             preserveSort="false">
                        <t:column>
                             <f:facet name="header">
                                        <h:outputText value="column1"  />
                                    </f:facet>
                             <h:outputText value="#{tablerow.col1}"/>
                        </t:column>
                        <t:column>
                             <f:facet name="header">
                                        <h:outputText value="column2"  />
                                    </f:facet>
                             <h:outputText value="#{tablerow.col2}"/>
                        </t:column>
                        <t:column>
                             <f:facet name="header">
                                        <h:outputText value="column3"  />
                                    </f:facet>
                             <h:outputText value="#{tablerow.col2}"/>
                        </t:column>
                        <t:column>
                             <f:facet name="header">
                                        <h:outputTextvalue="column4"  />
                                    </f:facet>
                             <h:outputText value="#{tablerow.col4}"/>
                        </t:column>
                        <t:column>
                             <f:facet name="header">
                                        <h:outputText value="column2"  />
                                    </f:facet>
                             <h:outputText value="#{tablerow.col5}"/>
                        </t:column>
                   </t:dataTable>
         </t:dataList>
    </h:form>
    </body>
    </html>
    </f:view>I have checked the table.sortColumn value, it is changed just in one table, but it affects somehow the display of the others, too.
    Just an example:
    I have Table1, Table2 and Table3 that are displayed each inside of the dataList.
    Every table has the same columns (column1 to 5).
    By default, each table is sorted by column1.
    If I click on the column2 header of Table2 to sort just Table2 by column2, Table1 and Table3 also get sorted by column2 (but have still the small arrow indicating that the sort is by column1).
    It's a bit tricky to describe :)
    I appreciate any help, maybe just a workaround.
    Edited by: coppermine on Jul 10, 2008 4:13 PM

    I have checked the table.sortColumn value, it is changed just in one table, but it affects somehow the display of the others, too.
    alizia
    [Wide Circles|http://www.widecircles.ca]

  • Deleting a dataTable item after sorting

    Hello,
    I am using a "h:dataTable" which has a 'delete' commandLink on every row.
    If I sort the table and then delete an item, the wrong item is deleted.
    The deleted item is the item that was originaly in the same place (before sorting).
    What should I do to fix that?
    Thank you,
    Dana

    Should I call "sortDataList" before deleting the item the way it was sorted in the previous request?
    If so, the function should receive an "ActionEvent event".
    public void sortDataList(ActionEvent event) {
            String sortFieldAttribute = getAttribute(event, "sortField");
    }What should I send as the parameter to the sorting function?

  • Sorting a JSF dataTable

    Hi all,
    How can the contents of JSF dataTable component be sorted (any column). I need solution in JSF.
    can any one show an example or code snippet.
    I have this code of dataTable and I want to sort it by Date Created.
    How I can associate my code of sort with this column.
    <h:dataTable value="#{viewCampaignPageBean.allCampaigns}" var="campaign"
    border="1" width="60%" cellpadding = "4" styleClass= "sample" headerClass="th"
    >
    <h:column>
    <f:facet name="header">
    <f:verbatim>Title</f:verbatim>
    </f:facet>
    <h:outputText value="#{campaign.title}" styleClass="tLabel" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <f:verbatim>Type</f:verbatim>
    </f:facet>
    <h:outputText value="#{campaign.campaignType}" styleClass="tLabel" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <f:verbatim>Date Created</f:verbatim>
    </f:facet>
    <h:outputText value="#{campaign.createDate}" styleClass="tLabel" />
    </h:column>
    </h:dataTable>Thanks in advance

    Check <a href="http://balusc.xs4all.nl/srv/dev-jep-dat.html"></a> � <a href="http://balusc.xs4all.nl/srv/dev-jep-dat.html#SortingDatatable"></a>.

  • How to create a Dynamic Datatable with sorting functioanlity

    Hi,
    I am new to JSF and need some help can some one please tell me how to create a dynamic datatable with sorting functionality. I am reading data data from a database table and wants to build the datatable dynamically based on the columns returned. I know how to created a datatble with a fixed number of columns but can't figure out how to create a datatable dynamically with sort functionality. Any small example will help.
    Thanks

    Hi,
    Here is what I have so far and can't figure out how to add the sorting functionality. Any help is appreciated.
    Managed Bean:
    private List<MyDto> data ;
        public HtmlDataTable getDataTableOne ()
            if ( dataTableOne == null )
                populateCheckBoxes () ; // Preload.
                populateDynamicDataTableOne () ;
            return dataTableOne ;
        public void populateCheckBoxes ()
            data = new ArrayList<MyDto> () ;
            MyDto myDto1 = new MyDto () ;
            MyDto myDto2 = new MyDto () ;
            MyDto myDto3 = new MyDto () ;
            MyDto myDto4 = new MyDto () ;
            myDto1.setChecked ( true ) ;
            myDto1.setValue ( "myDto1" ) ;
            myDto2.setChecked ( false ) ;
            myDto2.setValue ( "myDto2" ) ;
            myDto3.setChecked ( false ) ;
            myDto3.setValue ( "myDto3" ) ;
            myDto4.setChecked ( true ) ;
            myDto4.setValue ( "myDto4" ) ;
            data.add ( myDto1 ) ;
            data.add ( myDto2 ) ;
            data.add ( myDto3 ) ;
            data.add ( myDto4 ) ;
        public void populateDynamicDataTableOne ()
            dataTableOne = new HtmlDataTable () ;
            UIOutput header = new UIOutput () ;
            header.setValue ( "" ) ;
            UIColumn tableColumn ;
            tableColumn = new UIColumn () ;
            HtmlOutputText textHeader = new HtmlOutputText () ;
            textHeader.setValue ( "" ) ;
            tableColumn.setHeader ( textHeader ) ;
            HtmlSelectBooleanCheckbox tCheckBox = new HtmlSelectBooleanCheckbox () ;
            tCheckBox.setValueBinding ( "value" , FacesContext.getCurrentInstance ().getApplication ().createValueBinding ( "#{row.checked}" ) ) ;
            tableColumn.getChildren ().add ( tCheckBox ) ;
            // Set output.
            UIOutput output = new UIOutput () ;
            ValueBinding myItem = FacesContext.getCurrentInstance ().getApplication ().createValueBinding ( "#{row.value}" ) ;
            output.setValueBinding ( "value" , myItem ) ;
            // Set header (optional).
            UIOutput header2 = new UIOutput () ;
            header2.setValue ( "" ) ;
            UIColumn column = new UIColumn () ;
            column.setHeader ( header2 ) ;
            column.getChildren ().add ( output ) ;
            dataTableOne.getChildren ().add ( tableColumn ) ;
            dataTableOne.getChildren ().add ( column ) ;
    MyDto.java
    public class MyDto
        private Boolean checked;
        private String value;
        public MyDto ()
        public void setChecked ( Boolean checked )
            this.checked = checked;
        public Boolean getChecked ()
            return checked ;
        public void setValue ( String value )
            this.value = value;
        public String getValue ()
            return value ;
    JSP
    <h:dataTable id="table" value="#{myRequestBean.data}" binding="#{myRequestBean.dataTableOne}" var="row" />Thanks

  • Problem with column sort in myFaces dataTable

    Hello,
    In my dataTable I am trying to do a column sort on each column, When i click on the column header link nothing is happening. Could somebody please help. Please let me know if I am missing something.
    Here is the code.
    The jsf is as follows:
    <h:panelGrid columns="1" styleClass="tableHeaderAction">
    <t:dataTable id="fooS" value="#{supervisorsDto.tableRows}"
    var="tableRow" rows"30" styleClass="dataTable"
    headerClass="tableHeader" first="0"
    columnClasses="string,string,string,string"
    rowClasses="odd,even"
    sortAscending="#{supervisorsDto.ascending}"
    sortColumn="#{supervisorsDto.sort}"
    preserveSort="true" >
    <t:column>
    <f:facet name="header">
    <t:commandSortHeader columnName="lastName" arrow="false">
    <t:outputText value="#{screen.lastName}" />
    </t:commandSortHeader>
    </f:facet>
    <t:outputText value="#{tableRow.lastName}" />
    </t:column>
    <t:column>
    <f:facet name="header">
    <t:commandSortHeader columnName="firstName" arrow="false">
    <t:outputText value="#{screen.firstName}" />
    </t:commandSortHeader>
    </f:facet>
    <t:outputText value="#{tableRow.firstName}" />
    </t:column>
    <t:column>
    <f:facet name="header">
    <t:commandSortHeader columnName="loginName" arrow="false">
    <t:outputText value="#{screen.loginName}" />
    </t:commandSortHeader>
    </f:facet>
    <t:outputText value="#{tableRow.loginName}" />
    </t:column>
    <t:column>
    <f:facet name="header">
    <t:commandSortHeader columnName="team" arrow="false">
    <t:outputText value="#{screen.team}" />
    </t:commandSortHeader>
    </f:facet>
    <t:outputText value="#{tableRow.team}" />
    <h:inputHidden id="key" value="#{tableRow.empID}" />
    </t:column>
    </t:dataTable>
    </h:panelGrid>
    The sort method in SupervisorsDto is as follows:
    public class SupervisorsDto implements Serializable {
    private String sort="lastName";
    private boolean ascending= true;
    @SuppressWarnings("unchecked")
    public void sort(final String column,final boolean ascending)
    Comparator comparator = new Comparator()
    public int compare(Object o1, Object o2)
    Supervisors c1 = (Supervisors)o1;
    Supervisors c2 = (Supervisors)o2;
    if (column == null)
    return 0;
    if (column.equals("lastName"))
    return ascending ? c1.getLastName().compareTo(c2.getLastName()) : c2.getLastName().compareTo(c1.getLastName());
    else if (column.equals("firstName"))
    return ascending ? c1.getFirstName().compareTo(c2.getFirstName()) : c2.getFirstName().compareTo(c1.getFirstName());
    else if (column.equals("loginName"))
    return ascending ? c1.getLoginName().compareTo(c2.getLoginName()) : c2.getLoginName().compareTo(c1.getLoginName());
    else if (column.equals("team"))
    return ascending ? c1.getTeam().compareTo(c2.getTeam()) : c2.getTeam().compareTo(c1.getTeam());
    else return 0;
    Collections.sort(tableRows, comparator);
    public void sort(String sortColumn)
    if (sortColumn == null)
    throw new IllegalArgumentException("Argument sortColumn must not be null.");
    if (sort.equals(sortColumn))
    //current sort equals new sortColumn -> reverse sort order
    ascending = !ascending;
    else
    //sort new column in default direction
    sort = sortColumn;
    ascending = isDefaultAscending(sort);
    sort(sort, ascending);
    protected boolean isDefaultAscending(String sortColumn)
    return true;
    public String getSort() {
    return sort;
    public void setSort(String sort) {
    this.sort = sort;
    public boolean isAscending() {
    return ascending;
    public void setAscending(boolean ascending) {
    if(ascending != this.ascending)
    this.ascending = ascending;
    Thanks!

    I think I get really good at answering my own questions.
    It seems when you select the sort option on a column you must also set the "Sort Sequence".

  • Sort B1 DataTable - Code Inside...

    Hi
    I hope this will help you ...
    In case you know a  better way to implement this - please post your code...
    [B1Listener(BoEventTypes.et_ITEM_PRESSED, false)]
            public virtual void OnAfterItemPressed(ItemEvent pVal)
                bool ActionSuccess = pVal.ActionSuccess;
                Form oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
                if (pVal.Row < 0)
                    //click on headers...
                    //call sort DT according to Col.
                    Grid oGrid = (Grid) oForm.Items.Item("CFLG").Specific;
                    DataTable oDT = oGrid.DataTable;
                    oForm.Freeze(true);
                    SortDT(ref oDT , pVal.ColUID);
                    oForm.Freeze(false);
            public static bool SortDT(ref DataTable oDT, string ColName)
                //Copy To System DT
                System.Data.DataTable oSysDT = new System.Data.DataTable();
                // Add Cols
                for (int iCol = 0; iCol < oDT.Columns.Count; iCol++)
                    oSysDT.Columns.Add(oDT.Columns.Item(iCol).Name);
                for (int iRow = 0; iRow < oDT.Rows.Count; iRow++)
                    System.Data.DataRow oRow =  oSysDT.NewRow();
                    for (int iCol = 0; iCol < oDT.Columns.Count; iCol++)
                        oRow[iCol] = oDT.GetValue(iCol, iRow);
                    oSysDT.Rows.Add(oRow);
                //Sort DT
                SortSystemDataTable(oSysDT, ColName);
                //Copy Sorted table to B1DT
                oDT.Rows.Clear();
                oDT.Rows.Add(oSysDT.Rows.Count);
                for (int iRowCount = 0; iRowCount < oSysDT.Rows.Count; iRowCount++)
                    for (int iColCount = 0; iColCount < oSysDT.Columns.Count; iColCount++)
                        string scol = oDT.Columns.Item(iColCount).Name;
                        int icol = oSysDT.Columns.IndexOf(scol);
                        string sValue = oSysDT.Rows[iRowCount].ItemArray[icol].ToString();
                        if (oDT.Columns.Item(iColCount).Type == BoFieldsType.ft_Date)
                            if (sValue.Length > 0)
                                DateTime dDate = DateTime.Parse(sValue);
                                oDT.SetValue(iColCount, iRowCount, dDate);
                        else
                            if (sValue.Length > 0)
                                oDT.SetValue(iColCount, iRowCount, sValue);
                return true;
            private static void SortSystemDataTable(System.Data.DataTable oDT, string Sort)
                System.Data.DataTable newDT = oDT.Clone();
                int rowCount = oDT.Rows.Count;
                System.Data.DataRow[] foundRows = oDT.Select(null, Sort); // Sort with Column name
                for (int i = 0; i < rowCount; i++)
                    object[] arr = new object[oDT.Columns.Count];
                    for (int j = 0; j < oDT.Columns.Count; j++)
                        arr[j] = foundRows<i>[j];
                    System.Data.DataRow data_row = newDT.NewRow();
                    data_row.ItemArray = arr;
                    newDT.Rows.Add(data_row);
                //clear the incoming dt
                oDT.Rows.Clear();
                for (int i = 0; i < newDT.Rows.Count; i++)
                    object[] arr = new object[oDT.Columns.Count];
                    for (int j = 0; j < oDT.Columns.Count; j++)
                        arr[j] = newDT.Rows<i>[j];
                    System.Data.DataRow data_row = oDT.NewRow();
                    data_row.ItemArray = arr;
                    oDT.Rows.Add(data_row);
    Enjoy,
    J.

    J,
    If you search the Business One SDK forum on this topic you will find many posts that may help you.  Here is one as an example ...
    Re: sorting db datatable
    HTH,
    Eddy

  • Sorting Problem in DataTable

    Hi ,
    I don't know if we can do a workaround on this
    I am using Hibernate with ObjectListDataProvider bound to table
    The Scenario is as below
    1. let's say i have 4 fields in the database customer id , name ,address and email and all of them is sortable
    2. each row will have an edit button ( when u click on that , all those 4 fields will become textfield and allow user to save or cancel their changes with some validation )
    Here is the problem
    1. let's say user sort by customer name by clicking the customer name column .. thats fine . the table is sorted by customer name
    2. now he wants to edit some particular row at row N and enter his changes include changes on CUSTOMER NAME , when he clicks save
    he hits an error , so that particular row all still text field with some error messages
    But the particular row will be jumping around somewhere
    The Reason is because when the page refresh the table will resort the thing and in this case it will re sort based on Customer Name
    3. even he successfully updated ( made changes to Customer Name )
    the row also will still be jumping around
    How can we prevent this?
    How can we disable sorting/resorting at the run time progrmmatically?
    What i want is they can sort
    but as soon they edit / add new row
    the table will stay still and they can see the newly added row still stay in the last row
    or the row that they edit still stay at the Row N when they clicked the Button?
    Thanks

    Thanks Peluka.
    But even I don't enhance the vendor search help, I still found that the original standard version has this problem after sorting.
    Is that the program bug?
    Have anyone encountered this problem before?

Maybe you are looking for

  • Getting oracle.j2ee.xml.XMLMessages warningException error

    when I run a project in JDeveloper 11g for the first time i.,e when it starts the embedded oc4j server, I get "oracle.j2ee.xml.XMLMessages warningException WARNING: Exception Encountered" error. I am using TP4. this seems like a warning, is this some

  • Cable box hdmi to dvi out using 23" ACD possible to bypass hdcp?

    i got a 23" apple cinema, and when i use a hdmi adapter to plug my monitor into the back of my hd cable box, it says the display isn't hdcp compatible, i must disconnect to continue watching tv. any way to get around this yet? no need to wait for hd-

  • Control the Timeline, from a button inside a movieclip.

    First off, I have a movie clip called mc_instructions.  Inside the movie clip, about 940 frames into it, a button appears called btn_ready.  I need this button to bring me to frame 3 on the main timeline when clicked on. How can I do this in ActionSc

  • Can't add to Finder

    I used to be able to move files/folders to the finder window. I can't move them now. I can remove files/folder from the finder window. I have no clue why I can't do this now. I also have tried to change preferences to include my hard drive in the fin

  • Combining Data into one Cube from two Data-sources..

    Dear Experts, I am pulling data from two data sources and trying to combine in one Info-Cube. The data are like Data-Source 01 1. GUID  --Common 2.Document No ( User Entry) 3.Dist. Channel 4.Transaction Type 5.Date and Quantity Data-Source 02 1.GUID