4 Replies Latest reply on Apr 30, 2008 10:07 AM by esoj102sistemas

    datatablescroller not works

    esoj102sistemas

      Hello, escuse me for my english.

      <rich:datascroller> not works with <rich:dataTable>

      my .jsp file

      <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%><%@taglib
      uri="http://yui4jsf.sourceforge.net" prefix="yui"%><%@taglib
      uri="http://java.sun.com/jsf/html" prefix="h"%><%@taglib
      uri="http://www.jenia.org/jsf/popup" prefix="jp"%><%@taglib
      uri="http://richfaces.org/a4j" prefix="a4j"%><%@taglib
      uri="https://ajax4jsf.dev.java.net/ajax" prefix="ajax"%><%@taglib
      uri="http://richfaces.org/rich" prefix="rich"%><%@taglib
      uri="http://richfaces.ajax4jsf.org/rich" prefix="richfaces"%><%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      Insert title here





      <f:view>

      <h:form>

      <rich:dataTable id="datos2" binding="#{prueba.dt}" var="datos" rows="1" first="0">
      <f:facet name="header">
      <h:outputText value="Prueba de DataTable"></h:outputText>
      </f:facet>
      <rich:column>
      <f:facet name="header">
      <h:outputText value="Descripción"></h:outputText>
      </f:facet>
      <h:outputText value="#{datos.pag_concepto}"></h:outputText>
      </rich:column>
      <f:facet name="footer">
      <rich:datascroller for="datos2" id="p"></rich:datascroller>
      </f:facet>
      </rich:dataTable>



      <h:commandButton value="Buscar" action="#{prueba.buscar_action}"></h:commandButton>


      </h:form>

      </f:view>






      My BackingBean .java




      <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%><%@taglib
      uri="http://yui4jsf.sourceforge.net" prefix="yui"%><%@taglib
      uri="http://java.sun.com/jsf/html" prefix="h"%><%@taglib
      uri="http://www.jenia.org/jsf/popup" prefix="jp"%><%@taglib
      uri="http://richfaces.org/a4j" prefix="a4j"%><%@taglib
      uri="https://ajax4jsf.dev.java.net/ajax" prefix="ajax"%><%@taglib
      uri="http://richfaces.org/rich" prefix="rich"%><%@taglib
      uri="http://richfaces.ajax4jsf.org/rich" prefix="richfaces"%><%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      Insert title here





      <f:view>

      <h:form>

      <rich:dataTable id="datos2" binding="#{prueba.dt}" var="datos" rows="1" first="0">
      <f:facet name="header">
      <h:outputText value="Prueba de DataTable"></h:outputText>
      </f:facet>
      <rich:column>
      <f:facet name="header">
      <h:outputText value="Descripción"></h:outputText>
      </f:facet>
      <h:outputText value="#{datos.pag_concepto}"></h:outputText>
      </rich:column>
      <f:facet name="footer">
      <rich:datascroller for="datos2" id="p"></rich:datascroller>
      </f:facet>
      </rich:dataTable>



      <h:commandButton value="Buscar" action="#{prueba.buscar_action}"></h:commandButton>


      </h:form>

      </f:view>




      When I click on the commandbutton, we go to data base and get 3 records. I define rows="1" and the datatablescroller write 3 pages. This is correct but when i click on the arrow for go to next page, the datatablescroller no works.

      WHY???????????????????????????

        • 1. Re: datatablescroller not works
          esoj102sistemas

           

          "esoj102sistemas" wrote:
          Hello, escuse me for my english.

          <rich:datascroller> not works with <rich:dataTable>

          my .jsp file

          <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%><%@taglib
          uri="http://yui4jsf.sourceforge.net" prefix="yui"%><%@taglib
          uri="http://java.sun.com/jsf/html" prefix="h"%><%@taglib
          uri="http://www.jenia.org/jsf/popup" prefix="jp"%><%@taglib
          uri="http://richfaces.org/a4j" prefix="a4j"%><%@taglib
          uri="https://ajax4jsf.dev.java.net/ajax" prefix="ajax"%><%@taglib
          uri="http://richfaces.org/rich" prefix="rich"%><%@taglib
          uri="http://richfaces.ajax4jsf.org/rich" prefix="richfaces"%><%@ page language="java" contentType="text/html; charset=ISO-8859-1"
          pageEncoding="ISO-8859-1"%>
          <!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">
          <title>Insert title here</title>
          </head>
          <body>



          <f:view>

          <h:form>

          <rich:dataTable id="datos2" binding="#{prueba.dt}" var="datos" rows="1" first="0">
          <f:facet name="header">
          <h:outputText value="Prueba de DataTable"></h:outputText>
          </f:facet>
          <rich:column>
          <f:facet name="header">
          <h:outputText value="Descripción"></h:outputText>
          </f:facet>
          <h:outputText value="#{datos.pag_concepto}"></h:outputText>
          </rich:column>
          <f:facet name="footer">
          <rich:datascroller for="datos2" id="p"></rich:datascroller>
          </f:facet>
          </rich:dataTable>



          <h:commandButton value="Buscar" action="#{prueba.buscar_action}"></h:commandButton>


          </h:form>

          </f:view>

          </body>
          </html>



          My BackingBean .java


          package com.esoj.bd.comun;

          import java.util.ArrayList;
          import java.util.List;

          import javax.faces.context.FacesContext;
          import javax.faces.model.DataModel;
          import javax.faces.model.ListDataModel;
          import javax.faces.model.ResultDataModel;
          import javax.servlet.http.HttpSession;
          import javax.servlet.jsp.jstl.sql.ResultSupport;



          import com.esoj.bd.dao.CobrosDAO;
          import com.esoj.jsfbeans.comun.DataGridBean;
          import com.esoj.util.comun.ColumnHeader;
          import com.sun.rowset.CachedRowSetImpl;
          import org.richfaces.component.html.HtmlDataTable;
          import java.io.Serializable;

          public class Prueba{


          private CachedRowSetImpl crs = CobrosDAO.obtenerPagos();
          private HtmlDataTable dt = new HtmlDataTable();

          HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);

          public Prueba(){
          //JLMM Construimos los datos basicos para que se muestre el datagrid para esta seccion
          List headerList = new ArrayList();
          headerList.add(new ColumnHeader("id","0",false,"pag_id"));
          headerList.add(new ColumnHeader("Concepto","300",true,"pag_concepto"));
          headerList.add(new ColumnHeader("Importe","50",true,"pag_importe"));
          headerList.add(new ColumnHeader("Proveedor","300",true,"pag_proveedor"));
          headerList.add(new ColumnHeader("Fecha Vencimiento","200",true,"pag_fvencimiento"));
          headerList.add(new ColumnHeader("Forma Pago","100",true,"pag_fpago"));
          headerList.add(new ColumnHeader("Banco","50",true,"pag_banco"));
          valoresSesion(headerList);
          ((DataGridBean)session.getAttribute("datagrid")).getTabla().setRows(2);
          }

          public String buscar_action(){
          try {
          //CachedRowSetImp Object for DataTable value
          dt.setValue(CobrosDAO.obtenerPagos());
          } catch (Exception e) {
          System.out.println("Error en el metodo buscar_action de la Clase Cobros: " + e.getMessage());
          }
          return "probando";
          }


          private void valoresSesion(List headerList){
          if (((DataGridBean)session.getAttribute("datagrid")) == null){
          session.setAttribute("datagrid", new DataGridBean());
          ((DataGridBean)session.getAttribute("datagrid")).setColumnHeaders(new ListDataModel(headerList));
          }else{
          ((DataGridBean)session.getAttribute("datagrid")).setColumnHeaders(new ListDataModel(headerList));
          }

          }

          /**
          * @param crs the crs to set
          */
          public void setCrs(CachedRowSetImpl crs) {
          this.crs = crs;
          }

          /**
          * @return the crs
          */
          public CachedRowSetImpl getCrs() {
          return crs;
          }

          /**
          * @param dt the dt to set
          */
          public void setDt(HtmlDataTable dt) {
          this.dt = dt;
          }

          /**
          * @return the dt
          */
          public HtmlDataTable getDt() {
          return dt;
          }

          }



          When I click on the commandbutton, we go to data base and get 3 records. I define rows="1" and the datatablescroller write 3 pages. This is correct but when i click on the arrow for go to next page, the datatablescroller no works.

          WHY???????????????????????????


          • 2. Re: datatablescroller not works
            ilya_shaikovsky

            remove first="0" from dataTable.

            • 3. Re: datatablescroller not works
              esoj102sistemas

              ok, i remove first="0" but not works.

              • 4. Re: datatablescroller not works
                esoj102sistemas

                the arrow from datatablescroller are disabled. I cant understand which is the problem.