4 Replies Latest reply on Jun 22, 2009 3:11 PM by thiagofmam

    Problem with InputSpinner

    thiagofmam

      Hi,
      I m with problem in use of the InputSpinner on jsf dynamic.

      When some value is set the component not work for any button/event.

      Ex.:

      If when I m creating the component the value be different of null not work:

      
      spinner.setValue(32); // not will work
      spinner.setMaxValue(String.valueOf(paLimite.getVlrmaximo()));
       spinner.setMinValue(String.valueOf(paLimite.getVlrminimo()));
      spinner.setStep(String.valueOf(paLimite.getVlrsalto()));
      


      But if the value be null the spinne work well.

      Somebody can me help ?

      Sorry my english

        • 1. Re: Problem with InputSpinner
          ilya_shaikovsky

          this simple test case works for me under 3.3.1

          <form>
           <rich:inputNumberSpinner value="50" step="10" binding="#{userBean.spinner}" id="spinner"/>
           <a4j:commandButton action="#{userBean.change}" value="change" reRender="spinner"/>
          
          


          and in a request scoped bean:

          ...
           private UIInputNumberSpinner spinner;
          
           public void change(){
           spinner.setValue(32);
           }
          
           public UIInputNumberSpinner getSpinner() {
           return spinner;
           }
          
           public void setSpinner(UIInputNumberSpinner spinner) {
           this.spinner = spinner;
           }
          ...
          


          • 2. Re: Problem with InputSpinner
            thiagofmam

            Thank you for answer,

            In my case I need one dynamic number of inputSpinner on panelgrid.

            The sintax all ok,
            I don't understand why when the value is null all work.

            This form is included in the tabpanel with ajax submit.

            The code that I use below:

            private HtmlInputNumberSpinner getInputSpinner(Perfil_atributosT perfil_atributosT){
            
             int idPerfilAtributo = perfil_atributosT.getIdperfilatributo();
            
             FacesContext facesContext = FacesContext.getCurrentInstance();
             Application app = facesContext.getApplication();
            
             HtmlInputNumberSpinner spinner = (HtmlInputNumberSpinner) app.createComponent (HtmlInputNumberSpinner.COMPONENT_TYPE);
            
             spinner.setId("cmbPerfilSelecao_"+idPerfilAtributo);
            
             spinner.setValueExpression("value", app.getExpressionFactory().createValueExpression("#{detalheClienteMB.mapListVariaveis[" + idPerfilAtributo + "]}", String.class));
            
             String valor = getCTDVarPerfilPessoa(perfil_atributosT);
            
             mapListVariaveis.put(idPerfilAtributo,valor);
            
             try {
            
            
             Perfil_atributo_limiteConsultMB perfil_atributo_limiteConsultMB = new Perfil_atributo_limiteConsultMB();
             perfil_atributosT.setIdempresa(idEmpresa);
            
             Perfil_atributo_limiteT paLimite = perfil_atributo_limiteConsultMB.consultAction(perfil_atributosT);
             //spinner.setValueExpression("value", app.getExpressionFactory().createValueExpression("#{detalheClienteMB.mapListVariaveis["+ idPerfilAtributo +"]}", String.class));
            
            
             spinner.setMaxValue(String.valueOf(paLimite.getVlrmaximo()));
             spinner.setMinValue(String.valueOf(paLimite.getVlrminimo()));
             spinner.setStep(String.valueOf(paLimite.getVlrsalto()));
            
             if (valor != null) {
             spinner.setValue(valor);
             }
             else {
             spinner.setValue(null);
             }
            
             } catch (Exception e) {
             e.printStackTrace();
             }
             return spinner;
             }
            


            • 3. Re: Problem with InputSpinner
              thiagofmam

              The InputSpinner is show

              The problem is when I submit the form, the values not change or the commandbutton not work

              • 4. Re: Problem with InputSpinner
                thiagofmam

                The problem is resolved.

                The commandbutton submit value not worked because some inputSpinner values of minimum was as greater than the maximu value.

                Thank you