0 Replies Latest reply on Sep 11, 2007 6:14 AM by Thiagu Mariappan

    inputNumberSlider  instead of dataFilterSlider

    Thiagu Mariappan Novice

      Hai everyone

      this is my Database structure

      
      Tbl_products
      
      id product price
      
      1 cell 2000
      2 tv 5000
      3 dvd 4000
      


      i need to display this information in a table format , with dual slider. but Richface not have dual slider so we planed to use two FilterSlider. one for minimum price and another for maximum price.

      but i cant use two dataFilterSlider within single page

      i am using seam 2.0.0 Beata1

      http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080900

      so i planed to use use inputNumberSlider instead of dataFilterSlider
      but i have some issues , so any one help me
      this is my view part

      
      <a4j:form id="form1" reRender="table-body,maxprice" ajaxSubmit="true" ignoreDupResponses="true" requestDelay="500">
      
      <a4j:region id="stat1">
      <h:panelGrid columns="2" >
       <rich:inputNumberSlider minValue="1000" value="#{productsearch.mini}" width="200" maxValue="10000" step="500" id="minprice" onclick="submit()"/>
       <rich:inputNumberSlider minValue="1000" value="#{productsearch.maxi}" width="200" maxValue="10000" step="500" id="maxprice" onclick="submit()"/>
       <rich:spacer height="20" width="283" />
      </h:panelGrid>
      <a4j:outputPanel id="table-body">
      <rich:dataTable id="prodList" value="#{product}" var="row">
       <f:facet name="header">
       <h:column>
       <h:outputText value="product " />
       </h:column>
       <h:column>
       <h:outputText value="price" />
       </h:column>
       </f:facet>
      
       <h:column>
       <h:selectBooleanCheckbox value="#{row.product}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{row.price}" />
       </h:column>
      </rich:dataTable>
       </a4j:outputPanel>
      </a4j:region>
      </a4j:form>
      
      


      and this is my session bean class
      
      @Stateful
      @Name("product")
      public class ProductsAction implements ProductsLocal,
       Serializable
      {
      BigDecimal mini= null;
      BigDecimal maxi=null;
      
      @Out
      TblProducts<TblProducts > pro;
      
      ArrayList<TblProducts > temp;
      
      @PersistenceContext
      EntityManager em;
      
      @Begin(join=true)
      public String displayProducts()
      {
      pro=em.createQuery("select t from TblProducts t").getResultList();
      temp=new ArrayList(pro);
      return "go";
      }
      
      public BigDecimal getMini() {
      return mini;
      }
      
      public void setMini(BigDecimal mini) {
      this.mini = mini;
      ArrayList<TblProducts> temp1=new ArrayList<TblProducts>();
       for(TblProducts a:temp)
       {
       if((mini.compareTo(a.getPrice())<=0) && (maxi.compareTo(a.getPrice())>=0)) )
       temp1.add(a);
       }
       pro=temp1;
      }
      
      public BigDecimal getMaxi() {
       return maxi;
      }
      
      public void setMaxi(BigDecimal maxi) {
       this.maxi = maxi;
       if(this.maxi.compareTo(this.mini)<0)
       this.maxi=this.mini.add(new BigDecimal(500));
      }
      
      }
      


      this is our code its works fine.

      but our issue is we but onclick="submit()" event to inputNumberSlider ,
      so user click anywhere on the slider it filters the dataTable

      but if the user slides the filter pointer rashly out of the boundary, then the onclick function is not completing and its not working.

      we cant use onchange="submit()" event to inputNumberSlider , because it won't submit the form

      so how to resolve this problem
      any one help me

      By
      Thiagu.m