6 Replies Latest reply on Nov 25, 2014 7:27 PM by cllai

    Richfaces calendar - Show only month and year

    juza1

      I tried the solution proposed by Ilya [here][1] but I have a couple of problems:

       

      - the pop up shows correctly the months and years only, but january and july are missing

      - the `oncurrentdateselected` has no effect, i.e the corresponding field in the bean is never set...

       

      Here is my code:

       

          ...

          <td>
            <rich:calendar
                 id="billPeriod"
                 value="#{adminModel.billPeriodForSAP}"
                 popup="false"
                 showWeekDaysBar="false"
                 showFooter="false"
                 styleClass="special"
                 datePattern= "MM-yyyy"
                 oncurrentdateselected="alert('month(year) select:'+event.rich.date.toString());"
                 locale="#{adminModel.locale}"/>
          </td>
      

          ...

       

      I replaced "event.rich.component.selectDate(event.rich.date)" with the alert to the oncurrentdateselected just to see if something happens, but no alert appears...

       

      I'm using richfaces 4.2.1

       

      Do I still miss something

       

        [1]: http://relation.to/12480.lace

       

       

      EDIT:

      I tried to remove the style, which removes/hides the day. If I select a day, than the value in the bean is correctly set. Is it so, that at least a day have to be selected?

        • 1. Re: Richfaces calendar - Show only month and year
          bleathem

          Can you try a recent RichFaces release?  I seem to remember a fix re: missing months.

           

          I just tried the oncurrentdateselected attribute of the calendar widget and can confirm it fires.  Do you see any errors in your console?  Can you provide a full source code sample that I can use to reproduce your use case?

          • 2. Re: Richfaces calendar - Show only month and year
            juza1

            a little update:

             

            now I'm using richfaces 4.3.3, glassfish 3.1.2.2 and firefox 23 and I noticed the following behaviour:

            if the days table is not present, no event is fired. As soon as the table is there and you choose a day, the event is fired (at least handleEvent is called and the bean value is set,

            but still no alert pops up). But this happens only the first time you select a day and as long as you don't change the month, no other events are fired.

             

            Here an updated version of my code:

             

            <rich:calendar

              id="billPeriod"

              value="#{adminModel.billPeriodForSAP}"

              popup="false"

              showWeekDaysBar="false"

              showFooter="false"

              datePattern= "MM-yyyy"

              oncurrentdateselected="alert('Hello')"

              locale="#{adminModel.locale}">

              <a4j:ajax event="change" render="out" listener="#{adminModel.handleEvent}"/>

            </rich:calendar>

            <h:outputText id="out" value="... #{adminModel.billPeriodForSAP}"/>

            • 3. Re: Richfaces calendar - Show only month and year
              bleathem

              To be clear, you are asking for the following:

               

              1) oncurrentdateselected even should be fired when you select a month and the days table is not present

              2) when the days table is present, you expect the oncurrentdateselected event to be fired with every date click

               

              For 1), whould it make more snese to introduce a new event monthselected, rather than to override the existing event?

               

              Fir 2), should the oncurrentdateselected event not be fired until the apply button is clicked?  Try setting showApplyButton=false and see if you get the behaviour you expect.

              • 4. Re: Richfaces calendar - Show only month and year
                juza1

                Hello,

                 

                actually I'm asking that the example proposed by Ilya (see above) would work as it is exactly what I need.

                So the 1) is what should happen.

                 

                But I don't understand if it's a thing I should do in my code (in this case I don't know how as I'm quite a rookie in such things) or if it's a thing that you should still implement...

                • 5. Re: Richfaces calendar - Show only month and year
                  bleathem

                  I suspect this may have been resolved with RF-13102.  RichFaces 4.3.4 will be released shortly, we are just working through a RichFaces Push / Atmosphere failure on JBoss EAP 6.1.1.

                  • 6. Re: Richfaces calendar - Show only month and year
                    cllai

                    hi...I am using richfaces 4.5 final version. However, I am facing the issue missing of month January & July when I used the styleClass special. Pls help.

                     

                    .special tr[id]{

                        display:none;

                    }