5 Replies Latest reply on Dec 4, 2008 9:56 AM by Kerdudou Ronan

    calendar issue inside scrolling div

    Kerdudou Ronan Apprentice

      Inside a fixed DIV with scrolling enabled, i've got rich calendar elements in popup mode...
      when i scroll down in the div, the calendars have an issue, they no longer detect the presence of the clic inside them.
      when scrolling just a little, I'm able to select dates on the lasts weeks but not on the firsts...
      it's like the calculation of the calendar position has a bug...

      I'm on version 3.2.1.CR3 (as 3.2.1 and 3.2.2 have bloking issues for my app) i'll try soon to migrate in 3.2.2 with workarounds...

      it seems that very few people are using fixed divs... i describe my template of application in this post : http://www.jboss.com/index.html?module=bb&op=viewtopic&t=131124 (where the issue is solved by 3.2.1)

        • 2. Re: calendar issue inside scrolling div

          This seems to be biting a few people in different ways.

          I removed the context menu from my datatable due to this.

          I also noticed that this has not been scheduled.

          Please comment on the status of a fix or workaround for this issue.

          • 3. Re: calendar issue inside scrolling div
            Kerdudou Ronan Apprentice

            on jira i see :

            Seems that recalculation position on scroll isn't good idea.. But may be we just should close this popups on scroll also as for simple loosing focus. (We could add attribute to make it optionall)

            on an other post i see :
            Before scroll it appears in the proper position. After scroll it is near the top of the scrolling container.

            but in my case, if i scroll and click on the calendar, it opens in the right place, but no longer detect clics on it, the area of autorized click is too mush down at 2 times the scroll... as if somewhere the scroll position is added 2 times...

            if i debug, i see that on the click on the date cell, the onclick method is executed -> $('componentID').component.eventCellOnClick(event, this);
            then an event is produced, i think to detect if we click outside the component, and it's at this moment the calculation of the div position is wrong, so it calls the function to close the calendar...

            • 4. Re: calendar issue inside scrolling div
              Kerdudou Ronan Apprentice

              In the given Jira, I saw :
              Type: Feature Request
              Fix Version/s: Wishes

              I think it is not a wish nor a feature request but a bug of the rich:calendar component.

              Please try the following:
              - add a rich:calendar (in a popup mode) in a scrollable div
              - Make the div scroll
              - open the calendar's popup
              - if you want to click on "previous month" or "next month" buttons, the popup disapear.
              In this case, there is no way to "navigate" in the calendar.

              It's remind me the fixed jira

              It's just like the popup position was fixed by RF-2079 but not the "close popup on click outside" behavior of the calendar.

              Is there a mean to disable the "on click outside" behavior. In this case, the enduser should close the popup manually. Perhaps, it could be an easy workaround.

              Richfaces team, could you please check this. It's a very annoying bug because our enduser cannot choose another month in the calendar.

              Please give us any advice or answer.

              • 5. Re: calendar issue inside scrolling div
                Kerdudou Ronan Apprentice

                looking at recent source of the calendar make me think that it's nearly resolved in 3.3 but i can't test it now...

                i've solved my issue by adding the folowing function in my app executed on every endOfAxaxRequest and at the document.ready :

                function corrigerCalendriers() {
                 var cals = jQuery(".rich-calendar-popup");
                 for(var i=0;i<cals.length;i++){
                 cals[ i].onclick= function(){this.component.skipEventOnCollapse=true;};

                in 3.3 the table "rich-calendar-popup" is created with onclick="this.component.skipEventOnCollapse=true" but 'this' is replaced by a complex getter -> you can optimise it.
                also, it's no longer usefull in calendar.js 'eventOnCollapse' to use the obsolete folowing line :
                if (Position.within($(this.id), Event.pointerX(e), Event.pointerY(e))) return true;

                (note that 'Position' is obsolete in Prototype)
                note that the presence of this line when scrolling makes a click under the calendar not collapsing it, and when we have a list of calendars, then if we scroll, we can open several calendard from top to botom...

                Finally, there is still a little bug that i can't hack by javascript but, that you will easilly correct in 3.3 if it's not yet done : when the calendar popup is configured to select the time, then the div of the time selector should also set skipEventOnCollapse to true because if not, when i scrolled, a click to select the time will collapse the calendar...