13 Replies Latest reply: Mar 29, 2012 12:14 PM by Anderson Simões Vieira RSS

datascroller not working from 2nd page

chakravarthi reddy Newbie

I am new to JSF and richfaces. I am trying to use a datascroller with a richdattable. I get the datscroller at table footer. It displays first page correctly. But pressing on the datascroller for 2nd column dose not work. I mean it does not show it as a link only. My code is as follows

 

<rich:column>
                 
<f:facet name="header">
                   
<h:outputText value="#{templateSearchRB.TemplateNameHeader}" styleClass="TemplateSearchResultHeader"/>
                 
</f:facet>
               
<a4j:commandLink value="#{template.templateName}" action="#{backing_TemplateSearch.templateNameDetails}"/>

              
</rich:column>
              
<rich:column>
               
<f:facet name="header" >
               
<h:outputText value="#{templateSearchRB.TemplateReferenceHeader}"
                           
styleClass="TemplateSearchResultHeader"/>
              
</f:facet>
              
<h:outputText value="#{template.templateReference}"/>
             
</rich:column>
            
<rich:column>
              
<f:facet name="header">
              
<h:outputText value="#{templateSearchRB.CountryHeader}"
                           
styleClass="TemplateSearchResultHeader"/>
              
</f:facet>
             
<h:outputText value="#{template.country}"/>
           
</rich:column>
          
<rich:column>
            
<f:facet name="header">
             
<h:outputText value="#{templateSearchRB.LanguageHeader}"
                           
styleClass="TemplateSearchResultHeader"/>
           
</f:facet>
            
<h:outputText value="#{template.language}"/>

         
</rich:column>
       
<h:inputHidden value="#{template.subject}" />
       
<h:inputHidden value="#{template.templateContent}" />
      
<f:facet name="footer">
      
<rich:datascroller for="templateSearch" maxPages="10" align="right"  reRender="templateSearch" id="sc2"/>
      
</f:facet>
    
</rich:dataTable>

 

 

the output page screen shot is attached. if i click on 2nd page on datscroller nothing happens!!

  • 1. Re: datascroller not working from 2nd page
    Kike Gil Novice

    what kind of scope are you using??? @requestscoped??

  • 2. Re: datascroller not working from 2nd page
    chakravarthi reddy Newbie

    Hi,

     

    I use JSF 1.2 and I have no idea on scopes . I wrote a richfaces table which gets rerenderd when a comman button is pressed. I thought of adding datascroller because i get high records. But had this problem. I went through documenation but could not figure out what page attribute means. please help 

  • 3. Re: datascroller not working from 2nd page
    Kike Gil Novice

    you must have a bean class. your class is templateSearchRB and template, is not?

     

    can you put the code of your bean class???

  • 4. Re: datascroller not working from 2nd page
    chakravarthi reddy Newbie

    ___Bean Class

     

    package com.apple.ist.ce.managedbeans;

     

     

    import com.apple.ist.ce.dao.CountryDAO;

    import com.apple.ist.ce.dao.CreateTemplateDAO;

    import com.apple.ist.ce.dao.LanguageDAO;

     

    import com.apple.ist.ce.dao.UserDAO;

    import com.apple.ist.ce.services.CeServiceImpl;

     

    import java.util.ArrayList;

     

     

    import javax.faces.context.FacesContext;

     

    import javax.faces.event.ActionEvent;

     

    import javax.faces.model.SelectItem;

    import javax.servlet.ServletContext;

    import javax.servlet.http.HttpServletRequest;

    import javax.servlet.http.HttpSession;

     

    //import com.apple.ist.ce.components.PagerDelux;

     

    import java.util.ResourceBundle;

     

    import javax.servlet.ServletContext;

    import javax.naming.InitialContext;

     

    import org.richfaces.component.html.HtmlDataTable;

     

    public class TemplateSearch {

     

        private HtmlDataTable templateResultsTable;

        private ArrayList templateResults;

        //private TemplateSearchTable templateSearchTable;

        private CreateTemplateDAO createTemplateDAO;

        private String templateName;

        private String country = "28";

        private String language = "3";

        private String countryValue;

        private String languageValue;

        private String templateNameValue;

        private String templateId;

        private String businessFunction;

        private String businessReference;

        private String communicationType;

        private String subject;

        private String templateContent;

        private String status;

        private String templateReference;

        private String validFrom;

        private String validTo;

        private String countryLanguageValues;

        private ArrayList countryList;

        private ArrayList languageList;

        private String strActionItem;

        private boolean dataScrollerDisplay = false;

        private String emptyMessage;

        //private PagerDelux paginator;

        private String firstName;

        private String lastName;

        private String url;

        private TemplateDefinition templateDefinition;

        private boolean loadonce;

        private String templateRefValue;

        private String templateRef;

        private Boolean flag= true;

        FacesContext facesContext = FacesContext.getCurrentInstance();

        HttpServletRequest request =

            (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();

        HttpSession session = request.getSession();

        ServletContext context = null;

     

        public TemplateSearch() {

            System.out.println("=====IN Constructor=====");

            this.templateResults = new ArrayList();

            countryList = new ArrayList();

            languageList = new ArrayList();

            createTemplateDAO = new CreateTemplateDAO();

           templateDefinition =(TemplateDefinition)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("backing_TemplateDefinition");

            context = (ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext();

        }

     

        public String logoutfunctioncall() {

            System.out.println("In logout method");

            if (session != null) {

                System.out.println("Invalidating session in template search.........");

                session.invalidate();

            }

            return null;

        }

     

       public String formClear(){

           System.out.println("In Clear Method in template search.........");

          

           this.setTemplateName(null);

           this.setLanguage(null);

           this.setCountry(null);

           this.setTemplateNameValue(null);

           this.setLanguageValue(null);

           this.setCountryValue(null);

           if(templateResults.size()>0){

               templateResults.clear();

              

           }

          

        return null;

       }

        public void setTemplateResultsTable(HtmlDataTable templateResultsTable) {

     

            this.templateResultsTable = templateResultsTable;

        }

     

        public HtmlDataTable getTemplateResultsTable() {

            return templateResultsTable;

        }

     

        public void setTemplateResults(ArrayList templateResults) {

            this.templateResults = templateResults;

        }

     

        public ArrayList getTemplateResults() {

     

            return templateResults;

        }

     

     

        public String doAdd() {

            System.out.println("====================In ADD=============");

            this.strActionItem = "add";

            return "add";

        }

     

     

        public void doSearchTemplate() {

            System.out.println("In Search Method " + templateResults.size());

     

            if (templateResults.size() > 0) {

                templateResults.clear();

            }

            try {

                CeServiceImpl serImpl = new CeServiceImpl();

                CreateTemplateDAO bean = new CreateTemplateDAO();

                bean.setBusinessFunction(this.businessFunction);

                bean.setBusinessReference(this.businessReference);

                bean.setCommunicationType(this.communicationType);

                bean.setCountry(this.country);

                bean.setEmailSubject(this.subject);

                bean.setLanguage(this.language);

                bean.setStatus(this.status);

                bean.setTemplateContent(this.templateContent);

                bean.setTemplateName(this.templateName);

                bean.setTemplateNameValue(this.templateNameValue);

                bean.setTemplateReference(this.templateReference);

                bean.setValidFrom(this.validFrom);

                bean.setValidThrough(this.validTo);

                bean.setTemplateRef(this.templateRef);

                bean.setTemplateRefValue(this.templateRefValue);

                ArrayList list = serImpl.searchTemplateRequestImpl(bean);

                System.out.println("Empty Message value is ************** : bean.getStatusMsg()  :: " + bean.getStatusMsg());

                this.setEmptyMessage(bean.getStatusMsg());

                System.out.println("Empty Message value is ************** : setEmptyMessage :: " + this.getEmptyMessage());

                this.setTemplateResults(list);

               

     

     

                if (bean.getTemplateID() != null) {

                    System.out.println("templateId1   " + bean.getTemplateID());

                    this.setTemplateId(bean.getTemplateID());

                }

     

     

            } catch (Exception e) {

                e.printStackTrace();

     

            }

     

        }

     

        public String templateNameDetails() {

            System.out.println("======In showtemplate========"+templateDefinition);

         

            this.strActionItem = "showTemplate";

            try {

                CeServiceImpl serImpl = new CeServiceImpl();

                int row = templateResultsTable.getRowIndex();

     

                for (int i = 0; i < this.templateResults.size(); i++) {

                    CreateTemplateDAO bean =(CreateTemplateDAO)templateResults.get(i);

     

                    if (row == i) {

                        // System.out.println("----------Entered---------"+bean.getc);

                        this.setTemplateId(bean.getTemplateID());

                        bean = serImpl.templateDetailsRequest(bean);

                        session.setAttribute("DAOBEAN", bean);

                        System.out.println("After setting the DAo bean "+bean);

                        //facesContext.getExternalContext().getSessionMap().put("DAOBEAN",bean);

                    }

     

     

                }

     

     

            } catch (Exception e) {

                e.printStackTrace();

            }

     

            return "templateCreate";

        }

     

     

        public void setTemplateName(String templateName) {

            this.templateName = templateName;

        }

     

        public String getTemplateName() {

            return templateName;

        }

     

        public void setCountry(String country) {

     

            this.country = country;

        }

     

        public String getCountry() {

            return country;

        }

     

        public void setLanguage(String language) {

            this.language = language;

        }

     

        public String getLanguage() {

            return language;

        }

     

        public void setCountryValue(String countryValue) {

            this.countryValue = countryValue;

        }

     

        public String getCountryValue() {

            return countryValue;

        }

     

        public void setLanguageValue(String languageValue) {

            this.languageValue = languageValue;

        }

     

        public String getLanguageValue() {

            return languageValue;

        }

     

        public void setTemplateNameValue(String templateNameValue) {

            this.templateNameValue = templateNameValue;

        }

     

        public String getTemplateNameValue() {

            return templateNameValue;

        }

     

        public void setTemplateId(String templateId) {

            this.templateId = templateId;

        }

     

        public String getTemplateId() {

            return templateId;

        }

     

        public void setBusinessFunction(String businessFunction) {

            this.businessFunction = businessFunction;

        }

     

        public String getBusinessFunction() {

            return businessFunction;

        }

     

        public void setBusinessReference(String businessReference) {

            this.businessReference = businessReference;

        }

     

        public String getBusinessReference() {

            return businessReference;

        }

     

        public void setCommunicationType(String communicationType) {

            this.communicationType = communicationType;

        }

     

        public String getCommunicationType() {

            return communicationType;

        }

     

        public void setSubject(String subject) {

            this.subject = subject;

        }

     

        public String getSubject() {

            return subject;

        }

     

        public void setTemplateContent(String templateContent) {

            this.templateContent = templateContent;

        }

     

        public String getTemplateContent() {

            return templateContent;

        }

     

        public void setStatus(String status) {

            this.status = status;

        }

     

        public String getStatus() {

            return status;

        }

     

        public void setTemplateReference(String templateReference) {

            this.templateReference = templateReference;

        }

     

        public String getTemplateReference() {

            return templateReference;

        }

     

        public void setValidFrom(String validFrom) {

            this.validFrom = validFrom;

        }

     

        public String getValidFrom() {

     

            return validFrom;

        }

     

        public void setValidTo(String validTo) {

            this.validTo = validTo;

        }

     

        public String getValidTo() {

            return validTo;

        }

     

        public void setCreateTemplateDAO(CreateTemplateDAO createTemplateDAO) {

            this.createTemplateDAO = createTemplateDAO;

        }

     

        public CreateTemplateDAO getCreateTemplateDAO() {

            return createTemplateDAO;

        }

     

        public void setCountryLanguageValues(String countryLanguageValues) {

            this.countryLanguageValues = countryLanguageValues;

        }

     

        public String getCountryLanguageValues() {

            return null;

        }

     

        public String userDetails()

        {

        this.setLoadonce(true);

           

          System.out.println("  TemplateSearch"+templateResults.size());

          //TemplateDefinition td;

          if (templateDefinition == null)

          {

          templateDefinition=(TemplateDefinition)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("backing_TemplateDefinition");

              System.out.println("Next");

          }

          System.out.println("Next 1");

              //=new TemplateDefinition();

              //String abc = templateDefinition.getPreviousRecordsEntry1();

              System.out.println("abc" + templateDefinition.getPreviousRecordsEntry1());

               this.setFlag(templateDefinition.getPreviousRecordsEntry());

               System.out.println("templateDefinition.getPreviousRecordsEntry();" + templateDefinition.getPreviousRecordsEntry());

               System.out.println("FLAG Value: " + flag);

            System.out.println("Next 2");

         // }

         

        if(flag == false)

        {

        System.out.println("inside if");

          if(loadonce == true)

          {

            if (this.templateName != null)

            {

                this.setTemplateName(null);

            }

            if (this.templateNameValue != null)

            {

                this.setTemplateNameValue(null);

            }

            if (this.country != null)

            {

                this.setCountry(null);

            }

            if (this.language != null)

            {

                this.setLanguage(null);

            }

            if (!this.languageValue.equals(""))

            {

                this.setLanguageValue("");

            }

            if (!this.countryValue.equals(""))

            {

                this.setCountryValue("");

            }

            if (emptyMessage != null)

            {

                this.setEmptyMessage(null);

            }

            if(templateResults.size()>0)

            {

                templateResults.clear();

            }

          }

         

         

         

        }

        if(flag == true)

        {

            System.out.println("Inside else");

            flag = false;

            templateDefinition.setPreviousRecordsEntry(false);

            templateDefinition.setPreviousRecordsEntry1("hello");

                System.out.println("td.setPreviousRecordsEntry(false) :" + templateDefinition.getPreviousRecordsEntry());

                System.out.println("abc" + templateDefinition.getPreviousRecordsEntry1());

            //templateDefinition.setPreviousRecordsEntry(false);

        }

         

            UserDAO userDAO = (UserDAO)session.getAttribute("USERDAOBEAN");

     

        //  if(userDAO == null || (userDAO != null && userDAO.getStatus().equals("ERROR")) ){

         // return "error";

        // }else{

        // if(userDAO != null && userDAO.getStatus().equals("SUCCESS")){

          

            System.out.println("userDAO.getFirstname in templateSearch" +

                               userDAO.getFirstName());

            System.out.println("userDAO.getLastname in templateSearch" +

                               userDAO.getLastName());

            if (null != userDAO.getFirstName()) {

                this.setFirstName(userDAO.getFirstName());

            }

            if (null != userDAO.getLastName()) {

                this.setLastName(userDAO.getLastName());

            }

          

            try {

                ArrayList l_arrcountryLst =

                    (ArrayList)session.getAttribute("countryLangList");

                if (l_arrcountryLst == null) {

                    ArrayList l_countryList = null;

                    CeServiceImpl serImpl = new CeServiceImpl();

                    CreateTemplateDAO createTemplateDao =

                        serImpl.getCountryLanguageValuesImpl();

                    if (createTemplateDao != null) {

     

                        session.setAttribute("countryLangList", createTemplateDao.getCountryLanguageList());

                        session.setAttribute("letterTypeList", createTemplateDao.getLetterTypeList());

                        l_countryList = new ArrayList();

                        System.out.println("list size......" + createTemplateDao.getCountryLanguageList().size());

     

                        for (int i = 0; i < createTemplateDao.getCountryLanguageList().size();i++) {

                            CountryDAO cdao = (CountryDAO)createTemplateDao.getCountryLanguageList().get(i);

                            l_countryList.add(new SelectItem(cdao.getCountryId(),cdao.getCountry()));

     

     

                            /*          ArrayList langList = cdao.getLanguageList();

     

                                 for(int j=0;j<langList.size();j++){

                                     LanguageDAO ldao = (LanguageDAO)langList.get(j);

                                     langList.add(new SelectItem(ldao.getLanguageId(), ldao.getLanguage()));

     

                             }*/

     

                            // this.setLanguageList(langList);

                        }

                        this.setCountryList(l_countryList);

                        System.out.println("country size list" + countryList.size());

                        //System.out.println("language list size"+languageList.size());

                    }

     

                }

     

            } catch (Exception e) {

                e.printStackTrace();

     

            }

     

     

        // }

           return null;

        // }

     

        }

     

     

        public void setCountryList(ArrayList countryList) {

            this.countryList = countryList;

        }

     

        public ArrayList getCountryList() {

            return countryList;

        }

     

        public void setLanguageList(ArrayList languageList) {

            this.languageList = languageList;

        }

     

        public ArrayList getLanguageList() {

            return languageList;

        }

     

        public void countryValueChange(ActionEvent event) {

            System.out.println("======Entered countryValueChange====");

            //if (valueChangeEvent.getNewValue() != null) {

            // String countryValue = valueChangeEvent.getNewValue().toString();

            String countryValue = this.country;

            System.out.println("country val====" + countryValue);

     

            ArrayList l_langList = null;

            System.out.println("============Selected Country Code====" +

                               countryValue);

            ArrayList l_arrCountryLang =

                (ArrayList)session.getAttribute("countryLangList");

            if (l_arrCountryLang != null && l_arrCountryLang.size() > 0) {

                System.out.println("in if con====");

                l_langList = new ArrayList();

                for (int i = 0; i < l_arrCountryLang.size(); i++) {

                    CountryDAO cdao = (CountryDAO)l_arrCountryLang.get(i);

                    if (cdao.getCountryId().equals(countryValue)) {

                        ArrayList langList = cdao.getLanguageList();

                        for (int j = 0; j < langList.size(); j++) {

                            LanguageDAO ldao = (LanguageDAO)langList.get(j);

                            l_langList.add(new SelectItem(ldao.getLanguageId(),ldao.getLanguage()));

     

                        }

                    }

                }

     

                this.setLanguageList(l_langList);

                System.out.println("languageList size===" + getLanguageList().size());

            }

            // }

        }

     

        public void setStrActionItem(String strActionItem) {

            this.strActionItem = strActionItem;

        }

     

        public String getStrActionItem() {

            return strActionItem;

        }

     

        public void setDataScrollerDisplay(boolean dataScrollerDisplay) {

            this.dataScrollerDisplay = dataScrollerDisplay;

        }

     

        public boolean isDataScrollerDisplay() {

            if (templateResults.size() > 10) {

                return true;

            }

            return dataScrollerDisplay;

        }

     

        public void setEmptyMessage(String emptyMessage) {

            this.emptyMessage = emptyMessage;

        }

     

        public String getEmptyMessage() {

            return emptyMessage;

        }

     

        /*public void setPaginator(PagerDelux paginator) {

            this.paginator = paginator;

        }

     

        public PagerDelux getPaginator() {

            return paginator;

        }*/

     

        public void setFirstName(String firstName) {

            this.firstName = firstName;

        }

     

        public String getFirstName() {

            return firstName;

        }

     

        public void setLastName(String lastName) {

            this.lastName = lastName;

        }

     

        public String getLastName() {

            return lastName;

        }

     

        public void setUrl(String url) {

            this.url = url;

        }

     

        public String getUrl() {

            ResourceBundle resourceBundle = ResourceBundle.getBundle("/com/apple/ist/ce/resourcebundle/CEApplication_url");

            url = resourceBundle.getString("logout_url");

            System.out.println("url in get method:" + url);

            return url;

        }

     

        public void setTemplateDefinition(TemplateDefinition templateDefinition) {

            this.templateDefinition = templateDefinition;

        }

     

        public TemplateDefinition getTemplateDefinition() {

            return templateDefinition;

        }

     

        public void setLoadonce(boolean loadonce) {

            this.loadonce = loadonce;

        }

     

        public boolean isLoadonce() {

            return loadonce;

        }

     

        public void setTemplateRefValue(String templateRefValue) {

            this.templateRefValue = templateRefValue;

        }

     

        public String getTemplateRefValue() {

            return templateRefValue;

        }

     

        public void setTemplateRef(String templateRef) {

            this.templateRef = templateRef;

        }

     

        public String getTemplateRef() {

            return templateRef;

        }

     

        public void setFlag(Boolean flag) {

            this.flag = flag;

        }

     

        public Boolean getFlag() {

            return flag;

        }

    }

     

     

    ---complete jsp page

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

    "http://www.w3.org/TR/html4/loose.dtd">

    <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>

    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

    <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

    <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>

    <%@ taglib uri="http://javascript4jsf.dev.java.net" prefix="j4j" %>

     

     

    <script type="text/javascript" language="javascript" src="js/communication_engine.js"></script>

    <script type="text/javascript" language="javascript">

    function showError(emptyMessage){

    // alert("msg is ..."+ emptyMessage);

      if(emptyMessage == "error")

       alert("No Matching Records");

    }

     

        function clearthis(id){

       // alert(id);

       // alert("Hi");

        clearhere();

        }

    </script>

    <f:loadBundle basename="com.apple.ist.ce.resourcebundle.TemplateSearch"

                  var="templateSearchRB"/>

    <f:view>

      <html>

        <head>

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

           <title>Communication Engine - Template Search</title>

            <link rel="stylesheet" type="text/css" href="css/templatesearch.css"/>

          <link rel="stylesheet" type="text/css" href="css/ceapplication.css"/>

           <link rel="stylesheet" type="text/css" href="css/communications_engine.css"/>

         </head>

     

       <body class="MainDetailsDiv" onload="countryMenuJsFunction();">

       <h:form id="templateSearchForm">

        <a4j:jsFunction name="doTemplateSearch" action="#{backing_TemplateSearch.doSearchTemplate}" reRender="templateSearch" oncomplete="complete()" >

              <h:inputHidden/>

            </a4j:jsFunction>

        <a4j:jsFunction action="#{backing_TemplateSearch.userDetails}"

        reRender="countryMenu,fname,lname,templateSearch,templateName,languageMenuId,templateNameValue,languageValue,countryValue" name="countryMenuJsFunction" oncomplete="document.getElementById('templateSearchForm:onLoadWheel').style.display = 'none';"/>

        <a4j:jsFunction action="#{backing_TemplateSearch.formClear}"

        reRender="templateName,languageMenuId,countryMenu,templateSearch,templateNameValue,languageValue,countryValue" name="clearhere"/>

        <h:inputHidden id="goTo" value="#{backing_TemplateDefinition.previousRecordsEntry}"/>

       <table width="900" border="0" align="center" cellpadding="0" cellspacing="0">

         <tr>  

        <td height="159">

          

     

            <div class="topbar">

            <div class="floatleftlogo"><img src="images/icon.png" height=50 width=50></div>

            <div class="floatleft"><a href="Home.jsp" onMouseOver="document.pic1.src='images/HomeTab_MouseOver.png'" onMouseOut="document.pic1.src='images/HomeTab.png'"><img src="images/HomeTab.png" name="pic1" alt="Home" border=0 height=35 width=170></a></div>

            <div class="floatleft"><a4j:commandButton id="clrbtn" image="images/TemplateTab_Selected.png" onmouseover="document.pic2.src='images/TemplateTab_MouseOver.png'" onmouseout="document.pic2.src='images/TemplateTab_Selected.png'" onclick="clearthis(this.id);"/></div>

            <div class="floatleft"><a href="TokenSearch.jsp" onMouseOver="document.pic3.src='images/TokenTab_MouseOver.png'" onMouseOut="document.pic3.src='images/TokenTab.png'"><img src="images/TokenTab.png" name="pic3" alt="token" border=0 height=35 width=170></a></div>

            <div class="floatleft"><a href="CorrespondenceSearch.jsp" onMouseOver="document.pic4.src='images/CommunicationTab_MouseOver.png'" onMouseOut="document.pic4.src='images/CommunicationTab.png'"><img src="images/CommunicationTab.png" name="pic4" alt="communication" border=0 height=35 width=170></a></div>

            <div class="login">Hello,<h:panelGroup><h:outputLabel value="#{backing_TemplateSearch.firstName}" id="fname"/><f:verbatim> </f:verbatim><h:outputLabel value="#{backing_TemplateSearch.lastName}" id="lname"/></h:panelGroup> | <a4j:commandLink value="Sign Out" id="logoutFunction" reRender="templateSearchUrl" action="#{backing_TemplateSearch.logoutfunctioncall}" oncomplete="openNewURl();stopAllWheel('barWheel');"/><div>

            </div></div></div>

        </td>

        </tr>

     

    <tr>

        <td>

           

        <table width="100%" border="0" cellpadding="0" cellspacing="0">

        <h:graphicImage url="/images/SpinGear2.gif" id="onLoadWheel"/>

            <tr>

                <td height="50">

           

                    <table class="SubHeader" cellpadding="0" cellspacing="0" style="margin-top:-4px;" width="100%">

                    <tr>

                    <td>

                     <h:outputLabel value="#{templateSearchRB.SearchLabel}"></h:outputLabel>

                                     <h:inputHidden value="#{backing_TemplateSearch.templateId}" />

                    </td>

                    </tr>

                    </table>

           

                </td>

            </tr>

                   <h:inputHidden value="#{backing_TemplateSearch.url}" id="templateSearchUrl"/>

            <tr>

                <td>

     

                <div class = "content">

     

                <table class="DetailsTable" style="width:435px;">

                   

                    <tr>

                        <td><h:outputLabel value="#{templateSearchRB.TemplateNameLabel}"></h:outputLabel></td>

                                            <td>

                                                 <h:selectOneMenu value="#{backing_TemplateSearch.templateNameValue}" id="templateNameValue">

                                                        <f:selectItem itemValue="EQUALS" itemLabel= "=" />

                                                         <f:selectItem itemValue="LIKE" itemLabel="contains" />

                                                 </h:selectOneMenu>

                                            </td>

                                            <td> <h:inputText size="20" value="#{backing_TemplateSearch.templateName}" id="templateName"></h:inputText></td>

                    </tr>

                   

                                     <tr>

                        <td><h:outputLabel value="Template Reference"></h:outputLabel></td>

                                            <td>

                                                 <h:selectOneMenu value="#{backing_TemplateSearch.templateRefValue}" id="templateRefValue">

                                                        <f:selectItem itemValue="EQUALS" itemLabel= "=" />

                                                         <f:selectItem itemValue="LIKE" itemLabel="contains" />

                                                 </h:selectOneMenu>

                                            </td>

                                            <td> <h:inputText size="20" value="#{backing_TemplateSearch.templateRef}" id="templateRef"></h:inputText></td>

                    </tr>

                                    <tr>

                        <td><h:outputLabel value="#{templateSearchRB.CountryLabel}"></h:outputLabel>

               

          

               </td>

                        <td>

                            <h:selectOneMenu value="#{backing_TemplateSearch.countryValue}" id="countryValue">

                                                      <f:selectItem itemValue="EQUALS" itemLabel= "=" />

                                                      <f:selectItem itemValue="LIKE" itemLabel="contains" />

                                                    </h:selectOneMenu>

                        </td>

                        <td>

                                                        <a4j:region id="countryMenuRegion">

                                                         <h:selectOneMenu value="#{backing_TemplateSearch.country}" id="countryMenu">

                                                         <f:selectItem itemValue="" itemLabel="-- Choose Country --"/>

                                                         <f:selectItems value="#{backing_TemplateSearch.countryList}" />

                                                         <a4j:support event="onchange" actionListener="#{backing_TemplateSearch.countryValueChange}" reRender="languageMenuId" onsubmit="document.getElementById('templateSearchForm:countryWheel').style.display = 'block';" oncomplete="document.getElementById('templateSearchForm:countryWheel').style.display = 'none';"/>

                                                          </h:selectOneMenu>

                                                          </a4j:region>

                        </td>

                                            <td><h:graphicImage url="/images/SpinGear2.gif" id="countryWheel" style="display:none;"/></td>

                    </tr>

                    <tr>

                        <td><h:outputLabel value="#{templateSearchRB.LanguageLabel}"></h:outputLabel>

          

                                             </td>

                        <td>

                                                 <h:selectOneMenu value="#{backing_TemplateSearch.languageValue}" id="languageValue">

                                                  <f:selectItem itemValue="EQUALS" itemLabel= "=" />

                                                  <f:selectItem itemValue="LIKE" itemLabel="contains" />

                           

                                                  </h:selectOneMenu>

                        </td>

                        <td>

                            <h:selectOneMenu id="languageMenuId" value="#{backing_TemplateSearch.language}">

                                                     <f:selectItem itemValue="" itemLabel="-- Choose Language --"/>

                                                     <f:selectItems value="#{backing_TemplateSearch.languageList}" />

                                                      </h:selectOneMenu>

                                                    

                        </td>

                    </tr>

                                  

                                   

                    <tr>

                        <td> </td>

                    </tr>           

                    <tr>

           

     

         

          

                        <td>

                            <a4j:commandButton value="Search" style="text-align: center" action="#{backing_TemplateSearch.doSearchTemplate}" reRender="templateSearch" onclick="document.getElementById('templateSearchForm:searchWheel').style.display = 'block';" oncomplete="document.getElementById('templateSearchForm:searchWheel').style.display = 'none';showError('#{backing_TemplateSearch.emptyMessage}')">

                                                  <j4j:defaultAction/> 

                                                    </a4j:commandButton>

                                        

                                                 

                        </td>

             

                        <td>

                            <h:commandButton value="Add" style="text-align: center" action="#{backing_TemplateSearch.doAdd}">

                                                    </h:commandButton>

                        </td>

                                            <td>

                            <h:commandButton value="Clear" style="text-align: center" action="#{backing_TemplateSearch.formClear}">

                                                    </h:commandButton>

                        </td>

                    </tr>

                                  

                                   

                   

                </table>

     

                </div>           

     

                </td>

            </tr>

                    <h:graphicImage url="/images/SpinGear2.gif" id="searchWheel" style="display:none;"/>

            <tr>

                <td>

                    <div class="DetailsSpacing"></div>

                </td>

            </tr>

            <tr>

                <td height="50">

           

                    <table class="SubHeader" cellpadding="0" cellspacing="0" style="margin-top:-4px;" width="100%">

                    <tr>

                    <td>

                    <h:outputLabel value="#{templateSearchRB.ResultsLable}" />

                    </td>

                    </tr>

                    </table>

           

                </td>

            </tr>

           

         

            <tr>

               

                     <td>

     

                     <div id="resultsDiv">   

                      <table width="90%" border=0  cellpadding="4" cellspacing=1>

               

                       <a4j:outputPanel>

                        <rich:dataTable var="template" id="templateSearch" rows="3"

                              style="width:820px;background-color:#CCFFFF"   rowClasses="OddRow,EvenRow" cellspacing="0"

                            cellpadding="0" border="1" headerClass="SearchHeader"

                              value="#{backing_TemplateSearch.templateResults}"

                              binding="#{backing_TemplateSearch.templateResultsTable}">

                        <rich:column>

                          <f:facet name="header">

                            <h:outputText value="#{templateSearchRB.TemplateNameHeader}" styleClass="TemplateSearchResultHeader"/>

                          </f:facet>

                        <a4j:commandLink value="#{template.templateName}" action="#{backing_TemplateSearch.templateNameDetails}"/>

                     

                       </rich:column>

                       <rich:column>

                        <f:facet name="header">

                        <h:outputText value="#{templateSearchRB.TemplateReferenceHeader}"

                                    styleClass="TemplateSearchResultHeader"/>

                       </f:facet>

                       <h:outputText value="#{template.templateReference}"/>

                      </rich:column >

                     <rich:column>

                       <f:facet name="header">

                       <h:outputText value="#{templateSearchRB.CountryHeader}"

                                    styleClass="TemplateSearchResultHeader"/>

                       </f:facet>

                      <h:outputText value="#{template.country}"/>

                    </rich:column>

                   <rich:column>

                     <f:facet name="header">

                      <h:outputText value="#{templateSearchRB.LanguageHeader}"

                                    styleClass="TemplateSearchResultHeader"/>

                    </f:facet>

                     <h:outputText value="#{template.language}"/>

                 

                  </rich:column>

                <h:inputHidden value="#{template.subject}" />

                <h:inputHidden value="#{template.templateContent}" />

    <f:facet name="footer">

                   <rich:datascroller for="templateSearch" maxPages="10" align="right"  reRender="templateSearch" id="sc2"/>

                   </f:facet>    

             </rich:dataTable>

            

                 

              </a4j:outputPanel>

     

                  </table>

                    </div>

     

                </td>

            </tr>

     

        </table>

        </td>

    </tr>   

     

    </table>

     

    </h:form>

    </body>

    </html>

    </f:view>

  • 5. Re: datascroller not working from 2nd page
    Kike Gil Novice

    in your bean must put this

     

     

     

     

    @ManagedBean(name="templateSearchRB") ------here you can the name what you want.

    @SessionScoped

     

     

     

    public class TemplateSearch implements Serializable{

    .....

     

    from jsp page you can call the variables of the bean for example

     

    <h:inputText value="#{templateSearchRB.firtName}"/>

    <h:inputText value="#{templateSearchRB.language}"/>

     

    look this page http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=graphValidator&skin=blueSky

     

    i imagine that you use richfaces 4???

  • 6. Re: datascroller not working from 2nd page
    Kike Gil Novice

    all of this is because dataScroller oly works with sessionscoped

  • 7. Re: datascroller not working from 2nd page
    Ilya Shaikovsky Master

    datascroller do not care about any scopes really.

     

    It not works just because of unnesessary bindinngs usages

     

       binding="#{backing_TemplateSearch.templateResultsTable}">

     

    And b.t.w placing component instances to session scope in JSF will cause much more problems than fixes.

  • 8. Re: datascroller not working from 2nd page
    chakravarthi reddy Newbie

    @Ilya

     

    removing bindings did not help.

  • 9. Re: datascroller not working from 2nd page
    Kike Gil Novice

    IIya, in my case datascroller with session scoped works fine, but if i use requestscope, doesnt work, why?

  • 10. Re: datascroller not working from 2nd page
    Ilya Shaikovsky Master

    Kike Gil, what do you mean by session scoped? scroller itself do not bound to any bean so it can't be influeced with any scopes. prove: checkout http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=dataScroller&skin=blueSky

    change bean to be @RequestScoped, and see that no difference and it works fine on subsequent clicks..

     

    Options:

    • bindings issues
    • conditional rendering issues (some wrapper component could become not rendered if pointed to request scoped flag)
    • need to review concrete application more.. But it really should be simplified much.. it's too hard and time consuming to check something having that huge pages as above.
  • 11. Re: datascroller not working from 2nd page
    Kike Gil Novice

    then,i will look it again,but, i did a test, and i had

     

    a page with datascroller inside the form

    a bean with @SessionScoped

     

    so, it worked fine,

    i changed the scoped to @ViewScoped and also worked find althoug in my console appeared a trace saying  somthing thar "Failed to execute to page 2, reset to page 1"

    i changed to @RequestScoped and it didn't work

     

    i will try again

  • 12. Re: datascroller not working from 2nd page
    Anderson Simões Vieira Newbie

    I'm having the same problem in version Richfaces 4.2 using the browser Mozilla 1.7.12 (must use this browser). In the rest of the browsers work normally.

    Can you help me?

     

    Tks!

  • 13. Re: datascroller not working from 2nd page
    Anderson Simões Vieira Newbie

    Anderson Simões Vieira wrote:

     

    I'm having the same problem in version Richfaces 4.2 using the browser Mozilla 1.7.12 (must use this browser). In the rest of the browsers work normally.

    Can you help me?

     

    Tks!

     

     

    <?xml version="1.0" encoding="UTF-8"?> 

    <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                                            xmlns:f="http://java.sun.com/jsf/core"

                                            xmlns:h="http://java.sun.com/jsf/html"

                                            xmlns:ui="http://java.sun.com/jsf/facelets"

                                            xmlns:rich="http://richfaces.org/rich"

                                            xmlns:a4j="http://richfaces.org/a4j">

     

              <f:view contentType="text/html">

                        <h:head>

                        </h:head>

                        <h:body>

     

                            <h:form id="form">

                                      <rich:messages/>

       

                                      <a4j:outputPanel id="context">

                                                <a4j:dataTable value="#{testMBean.list}"

                                                                                        var="i"

                                                                                        id="tabela"

                                                                                        rows="10"

                                                                                        style="width:100%;">

                                                          <rich:column>

                                                              <f:facet name="header">

                                                                  <h:outputText value="id"/>

                                                        </f:facet>

                                                        <h:outputText value="#{i.id}"/>

                                                    </rich:column>

                                                                <rich:column>

                                                              <f:facet name="header">

                                                                  <h:outputText value="desc"/>

                                                        </f:facet>

                                                        <h:outputText value="#{i.desc}"/>

                                                    </rich:column>

                                                    <rich:column>

                                                              <f:facet name="header">

                                                                  <h:outputText value="desc2"/>

                                                        </f:facet>

                                                        <h:outputText value="#{i.desc2}"/>

                                                    </rich:column>

                                                    <rich:column>

                                                              <f:facet name="header">

                                                                  <h:outputText value="register"/>

                                                        </f:facet>

                                                        <h:outputText value="#{i.reg}"/>

                                                    </rich:column>

                                                    <rich:column>

                                                              <f:facet name="header">

                                                                  <h:outputText value="adm"/>

                                                        </f:facet>

                                                        <h:outputText value="#{i.adm}"/>

                                                    </rich:column>

                                                    <f:facet name="footer">

                                                                  <rich:dataScroller id="scroller" fastControls="hide" />

                                                    </f:facet>

                                                </a4j:dataTable>

                                      </a4j:outputPanel>           

                            </h:form>

                        </h:body>

              </f:view>

    </ui:composition>

     

    .

    Using <a4j:ajax render="@all" event="click" /> navigation works by the numbers, but by using the buttons on the scroller doesn't work.