Loading ...
Sorry, an error occurred while loading the content.

Adding a custom event to the event handling calendar

Expand Messages
  • tansjava
    Hi All, The yahoo calendar handles select , deselect etc, but can we write a custom handler to handle double click events , is there any way , can anybody
    Message 1 of 10 , Jun 26, 2007
    • 0 Attachment
      Hi All,
      The yahoo calendar handles select , deselect etc, but can we write a
      custom handler to handle double click events , is there any way , can
      anybody please help me on this .
      Regards Tanveer Pasha .
    • chonlia
      I d like this too, is it possible?
      Message 2 of 10 , Aug 17, 2007
      • 0 Attachment
        I'd like this too, is it possible?



        --- In ydn-javascript@yahoogroups.com, "tansjava" <tansjava@...> wrote:
        >
        > Hi All,
        > The yahoo calendar handles select , deselect etc, but can we write a
        > custom handler to handle double click events , is there any way , can
        > anybody please help me on this .
        > Regards Tanveer Pasha .
        >
      • Satyen Desai
        Hi, You can easily attach a double click handler to either the Calendar Container DIV or any region inside the Calendar Container DIV (using Calendar s
        Message 3 of 10 , Aug 18, 2007
        • 0 Attachment
          Hi,

          You can easily attach a double click handler to either the Calendar
          Container DIV or any region inside the Calendar Container DIV (using
          Calendar's domEventMap property).

          The following example (set up for another question) has a double-click
          handler attached, which selects the cells with a different color on
          double-click:

          http://yuiblog.com/sandbox/yui/v230/examples/calendar/selectWeekdayHeader.html

          However, even though this looks like it works, it really doesn't
          isolate single/double clicks - (you can see this by double-clicking on
          a 'single' selected cell). Browser's don't suppress single-click
          events when firing double-clicks:

          http://www.quirksmode.org/js/events_compinfo.html

          So the Calendar's default single click handler is executed when you
          double-click. At the very least you'd need to over-ride the Calendar's
          default single-click handler to get somewhat reliable behavior with
          both single and double clicks on the same element. Probably using a
          solution which uses a timeout and event counter to wait before
          executing the single-click handler code - in case it's really a double
          click.

          Hope that helps,
          Satyen
        • chonlia
          Thank you again Satyen, but i m so clumsy. I can t do this work for me. Maybe, do you have an example for a range of dates? ... click ...
          Message 4 of 10 , Aug 20, 2007
          • 0 Attachment
            Thank you again Satyen, but i'm so clumsy.

            I can't do this work for me. Maybe, do you have an example for a
            range of dates?

            --- In ydn-javascript@yahoogroups.com, "Satyen Desai" <sdezzi@...>
            wrote:
            >
            > Hi,
            >
            > You can easily attach a double click handler to either the Calendar
            > Container DIV or any region inside the Calendar Container DIV (using
            > Calendar's domEventMap property).
            >
            > The following example (set up for another question) has a double-
            click
            > handler attached, which selects the cells with a different color on
            > double-click:
            >
            >
            http://yuiblog.com/sandbox/yui/v230/examples/calendar/selectWeekdayHea
            der.html
            >
            > However, even though this looks like it works, it really doesn't
            > isolate single/double clicks - (you can see this by double-clicking
            on
            > a 'single' selected cell). Browser's don't suppress single-click
            > events when firing double-clicks:
            >
            > http://www.quirksmode.org/js/events_compinfo.html
            >
            > So the Calendar's default single click handler is executed when you
            > double-click. At the very least you'd need to over-ride the
            Calendar's
            > default single-click handler to get somewhat reliable behavior with
            > both single and double clicks on the same element. Probably using a
            > solution which uses a timeout and event counter to wait before
            > executing the single-click handler code - in case it's really a
            double
            > click.
            >
            > Hope that helps,
            > Satyen
            >
          • chonlia
            Hi again, I m using your example: http://yuiblog.com/sandbox/yui/v230/examples/calendar/selectWeekdayHea der.html and i now i have just one doubt: Why have i
            Message 5 of 10 , Aug 22, 2007
            • 0 Attachment
              Hi again,

              I'm using your example:
              http://yuiblog.com/sandbox/yui/v230/examples/calendar/selectWeekdayHea
              der.html and i now i have just one doubt:

              Why have i first click on cell to after double-click?

              Thanks.



              --- In ydn-javascript@yahoogroups.com, "Satyen Desai" <sdezzi@...>
              wrote:
              >
              > Hi,
              >
              > You can easily attach a double click handler to either the Calendar
              > Container DIV or any region inside the Calendar Container DIV (using
              > Calendar's domEventMap property).
              >
              > The following example (set up for another question) has a double-
              click
              > handler attached, which selects the cells with a different color on
              > double-click:
              >
              >
              http://yuiblog.com/sandbox/yui/v230/examples/calendar/selectWeekdayHea
              der.html
              >
              > However, even though this looks like it works, it really doesn't
              > isolate single/double clicks - (you can see this by double-clicking
              on
              > a 'single' selected cell). Browser's don't suppress single-click
              > events when firing double-clicks:
              >
              > http://www.quirksmode.org/js/events_compinfo.html
              >
              > So the Calendar's default single click handler is executed when you
              > double-click. At the very least you'd need to over-ride the
              Calendar's
              > default single-click handler to get somewhat reliable behavior with
              > both single and double clicks on the same element. Probably using a
              > solution which uses a timeout and event counter to wait before
              > executing the single-click handler code - in case it's really a
              double
              > click.
              >
              > Hope that helps,
              > Satyen
              >
            • chonlia
              I have some problems trying to imitate https://www.paguna.com/. Here is my code: http://www.chonli.com/yui/index.php
              Message 6 of 10 , Aug 22, 2007
              • 0 Attachment
                I have some problems trying to imitate https://www.paguna.com/.

                Here is my code:
                http://www.chonli.com/yui/index.php

                http://www.chonli.com/yui/includes/js/grupo_fechas.js


                Why always to do a double-click, first i have to click on cell?

                Why handleSelect fires before before Select? and why don't reset the
                calendar?

                How to just have a click to reset calendar and select cell? After,how
                to have a double-click to select a range of dates (with all
                intermediates)?

                Thanks.
              • chonlia
                Now and after creating a dblselect event in Calendar.js, I have the first approach to which I want to do (paguna.com). Although not absolutely, if it had some
                Message 7 of 10 , Aug 23, 2007
                • 0 Attachment
                  Now and after creating a dblselect event in Calendar.js, I have the
                  first approach to which I want to do (paguna.com).

                  Although not absolutely, if it had some aid, surely all serious but
                  easy one.

                  Here is my code:

                  http://www.chonli.com/yui/index.php

                  http://www.chonli.com/includes/js/grupo_fechas.js


                  My doubts:
                  How to reset the calendar leaving the last date selected (using
                  selectEvent)?

                  How to make a select of dates using two pages?

                  Thanks Again.
                • Satyen Desai
                  Hi, Sorry about the delayed response. Some feedback below which may help. ... I don t fully understand how this will fit into your application, and so maybe
                  Message 8 of 10 , Aug 27, 2007
                  • 0 Attachment
                    Hi,
                    Sorry about the delayed response. Some feedback below which may help.

                    > My doubts:
                    > How to reset the calendar leaving the last date selected (using
                    > selectEvent)?
                    >

                    I don't fully understand how this will fit into your application, and
                    so maybe misunderstanding the question, but you can implement it in
                    your selectEvent listener by using the "selected" property of the
                    Calendar.

                    var selectedDates = myCal.cfg.getProperty("selected");
                    // Work with a copy, just to be safe while you're looping
                    selectedDates = selectedDates.concat();

                    This will give you the currently selected dates, in order of selection.

                    You can then call Calendar.deselect(date) with all but the last date.
                    Something like the following:

                    for (var i = 0; i < selectedDates.length-1; i++) {
                    // getDateFromArray is the function you already have on the page
                    var deselectDate = getDateFromArray(selectedDates[i]);
                    myCal.deselect(deselectDate);
                    }
                    myCal.render();

                    See:
                    http://yuiblog.com/sandbox/yui/v230/examples/calendar/limitSelection.ht
                    ml for an example of this, but using the oldest selected date.

                    > How to make a select of dates using two pages?
                    >

                    At the least, you'll need extend your selection methods
                    (handleDblSelect) to work with the "pages" property of the
                    CalendarGroup. However since you're using Calendar.selectCell for
                    selection, this will not easily extend to use cases where the user
                    selects a start date in one month, clicks on the next button, and
                    selects a cell in another page.

                    It's probably better to implement your dblClick selection using the
                    Calendar.select method - where you don't need to work with
                    cellIndices, and just work with Dates. That way you don't need to
                    worry about which dates are currently rendered, and which ones are
                    not. The only downside is that you need to call Calendar.render()
                    after updating the selection, to see the changes which maybe a bit of
                    a performance hit.

                    Hope that helps,
                    Satyen

                    p.s. I believe I've mentioned this before, but in order to get
                    dblclick to truly work, you'll need to account for the fact that
                    Calendar's default single click handlers are also invoked during a
                    double click.
                  • chonlia
                    Thanks a lot for your help. I m trying to use select function, but don t works with a CalendarGroup. Why? ... help. ... and ... selection. ... date. ...
                    Message 9 of 10 , Aug 29, 2007
                    • 0 Attachment
                      Thanks a lot for your help.

                      I'm trying to use "select" function, but don't works with a
                      CalendarGroup. Why?


                      --- In ydn-javascript@yahoogroups.com, "Satyen Desai" <sdezzi@...>
                      wrote:
                      >
                      > Hi,
                      > Sorry about the delayed response. Some feedback below which may
                      help.
                      >
                      > > My doubts:
                      > > How to reset the calendar leaving the last date selected (using
                      > > selectEvent)?
                      > >
                      >
                      > I don't fully understand how this will fit into your application,
                      and
                      > so maybe misunderstanding the question, but you can implement it in
                      > your selectEvent listener by using the "selected" property of the
                      > Calendar.
                      >
                      > var selectedDates = myCal.cfg.getProperty("selected");
                      > // Work with a copy, just to be safe while you're looping
                      > selectedDates = selectedDates.concat();
                      >
                      > This will give you the currently selected dates, in order of
                      selection.
                      >
                      > You can then call Calendar.deselect(date) with all but the last
                      date.
                      > Something like the following:
                      >
                      > for (var i = 0; i < selectedDates.length-1; i++) {
                      > // getDateFromArray is the function you already have on the
                      page
                      > var deselectDate = getDateFromArray(selectedDates[i]);
                      > myCal.deselect(deselectDate);
                      > }
                      > myCal.render();
                      >
                      > See:
                      >
                      http://yuiblog.com/sandbox/yui/v230/examples/calendar/limitSelection.h
                      t
                      > ml for an example of this, but using the oldest selected date.
                      >
                      > > How to make a select of dates using two pages?
                      > >
                      >
                      > At the least, you'll need extend your selection methods
                      > (handleDblSelect) to work with the "pages" property of the
                      > CalendarGroup. However since you're using Calendar.selectCell for
                      > selection, this will not easily extend to use cases where the user
                      > selects a start date in one month, clicks on the next button, and
                      > selects a cell in another page.
                      >
                      > It's probably better to implement your dblClick selection using the
                      > Calendar.select method - where you don't need to work with
                      > cellIndices, and just work with Dates. That way you don't need to
                      > worry about which dates are currently rendered, and which ones are
                      > not. The only downside is that you need to call Calendar.render()
                      > after updating the selection, to see the changes which maybe a bit
                      of
                      > a performance hit.
                      >
                      > Hope that helps,
                      > Satyen
                      >
                      > p.s. I believe I've mentioned this before, but in order to get
                      > dblclick to truly work, you'll need to account for the fact that
                      > Calendar's default single click handlers are also invoked during a
                      > double click.
                      >
                    • Satyen Desai
                      Can you provide an example of how you re trying to use it and we can look into it. Any errors? Thanks, Satyen ... From: chonlia To:
                      Message 10 of 10 , Aug 30, 2007
                      • 0 Attachment
                        Can you provide an example of how you're trying to use it and we can look into it.
                        Any errors?
                         
                        Thanks,
                        Satyen

                        ----- Original Message ----
                        From: chonlia <juanluis.suarez@...>
                        To: ydn-javascript@yahoogroups.com
                        Sent: Wednesday, August 29, 2007 9:32:19 AM
                        Subject: [ydn-javascript] Re: Adding a custom event to the event handling calendar

                        Thanks a lot for your help.

                        I'm trying to use "select" function, but don't works with a
                        CalendarGroup. Why?

                        --- In ydn-javascript@ yahoogroups. com, "Satyen Desai" <sdezzi@...>
                        wrote:

                        >
                        > Hi,
                        > Sorry about the delayed response. Some feedback below which may
                        help.
                        >
                        > > My doubts:
                        > > How to reset the calendar leaving the last date selected (using
                        > > selectEvent) ?
                        > >
                        >
                        > I don't fully understand how this will fit into your application,
                        and
                        > so maybe misunderstanding the question, but you can implement it in
                        > your selectEvent listener by using the "selected" property of the
                        > Calendar.
                        >
                        > var selectedDates = myCal.cfg.getProper ty("selected" );
                        > // Work with a copy, just to be safe while you're looping
                        >
                        selectedDates = selectedDates. concat();
                        >
                        > This will give you the currently selected dates, in order of
                        selection.
                        >
                        > You can then call Calendar.deselect( date) with all but the last
                        date.
                        > Something like the following:
                        >
                        > for (var i = 0; i < selectedDates. length-1; i++) {
                        > // getDateFromArray is the function you already have on the
                        page
                        > var deselectDate = getDateFromArray( selectedDates[ i]);
                        > myCal.deselect( deselectDate) ;
                        > }
                        > myCal.render( );
                        >
                        > See:
                        >
                        http://yuiblog. com/sandbox/ yui/v230/ examples/ calendar/ limitSelection. h
                        t
                        > ml for an example of this, but using the oldest selected date.
                        >
                        > > How to make a select of dates using two pages?
                        > >
                        >
                        > At the least,
                        you'll need extend your selection methods
                        > (handleDblSelect) to work with the "pages" property of the
                        > CalendarGroup. However since you're using Calendar.selectCell for
                        > selection, this will not easily extend to use cases where the user
                        > selects a start date in one month, clicks on the next button, and
                        > selects a cell in another page.
                        >
                        > It's probably better to implement your dblClick selection using the
                        > Calendar.select method - where you don't need to work with
                        > cellIndices, and just work with Dates. That way you don't need to
                        > worry about which dates are currently rendered, and which ones are
                        > not. The only downside is that you need to call Calendar.render( )
                        > after updating the selection, to see the changes which maybe a bit
                        of
                        > a performance hit.
                        >
                        > Hope that helps,
                        > Satyen
                        >
                        > p.s. I believe I've mentioned
                        this before, but in order to get
                        > dblclick to truly work, you'll need to account for the fact that
                        > Calendar's default single click handlers are also invoked during a
                        > double click.
                        >




                        Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
                      Your message has been successfully submitted and would be delivered to recipients shortly.