Davs Rants and Random Thoughts

December 1, 2006

Calendar examples updated

Filed under: ajax, yui, css, javascript, code, Yahoo! — Dav Glass @ 10:06 am

I have updated my calendar examples to include the changes for YUI Version .12. The following examples have been updated:

UPDATE: I added 2 more calendar examples that aren’t in this list:

Add to:
| Digg it | Slashdot | Y! MyWeb

16 Responses to “Calendar examples updated”

  1. MyAvatars 0.2 Rich Says:

    Dave,

    Safari (WebKit) has issues with two of the examples. Found with latest OS and Safari 2.0.4 (419.3).

    Calendar Attached to Text Input - the calendar opens behind the source listing, just a few pixels at the top is visible.

    Calendar with tooltip selected days - the tooltips are only a few pixels in height.

    Neither of these problems is found with Firefox 2.0 on OS X.

  2. MyAvatars 0.2 Dav Glass Says:

    Rich –

    I have fixed the issue with the “Calendar Attached to Text Input”, but I can not duplicate the issue with the tool tips…

  3. MyAvatars 0.2 Rich Says:

    Interesting…

    The tooltips work in Safari, but not in NetNewsWire (which uses WebKit).

  4. MyAvatars 0.2 Dav Glass Says:

    ah –

    I have noticed that the Javascript Interpreter that NetNewsWire uses does not work very well..

  5. MyAvatars 0.2 Ryan Says:

    Hi Dave,

    I think there is a small bug with the Calendar Text Input example: http://blog.davglass.com/files/yui/cal2

    If you click the forward arrow to go to Januray 2007, choose a date, then click back on the text field to select a new date, it won’t let you.
    It doesn’t seem to work on the latest FF and IE 7 on windows xp. But, it looks like Opera 9 works fine. Weird.

    Just thought you should know about that.

    Thanks for the GREAT examples!

  6. MyAvatars 0.2 Dav Glass Says:

    Ryan –

    Thanks for that catch.. The example has been updated.

    It was a real weird one.. It seems that the Calendars render function makes a call to :

    YAHOO.util.Event.purgeElement(this.oDomContainer, true);

    That was killing my listeners for mouseover and mouseout.. I have moved them into a renderEvent CustomEvent so they will be recreated when the calendar gets re-rendered..

  7. MyAvatars 0.2 qin Says:

    Dave:

    I like the Calendar popup from text field. When I tried your updated version, I got $E, $D and $T undefined errors. When I
    tried your original example, it works fine. What are those $E, E and T? Where are they defined?

    I also like the tooltip sample? How can I integrate that example to the calendar popup from text field example? I have all
    tip msg stored in database. I’d like to see mouse over event calls DWR methods to retrieve the tip msg from database. If
    the msg avaialbe for that date, it would show it as a tip. Otherwise, display nothing. Is it possbile to do? Please advise.
    Thanks.

  8. MyAvatars 0.2 Dav Glass Says:

    qin –

    The $, $E, $D, $T vars are all part of my YUI Tools package, you can find it here:
    http://blog.davglass.com/files/yui/tools/

    As for the tooltips, I would be rather simple to do. I wouldn’t recommend doing an HXR on a mouse over.. I would suggest that it be done before the loading of the calendar.. Doing it on mouseover would likely give you a DOS attack on your entry point.. It would really eat up bandwidth and extra requests to the server.

    Cheers..
    Dav

  9. MyAvatars 0.2 bhargav Says:

    hi,
    i’m using popup calender in my application, it is displaying calender on the specified location.. its good.
    but i have to retrive the date fields from the popup calender only . let me know the way ..plz
    itsis very urgent

    bhargav

  10. MyAvatars 0.2 AJ Says:

    Is it possible to attache the calendar to multiple text fields within the one form. I am havinf some problems. I ran up a quick hack, that takes a var in init, then looks for “calContatiner”+dateElement; I am not getting any errors but calendars do not display. I can mail you my crude hack. Any suggestions on how I would do this?

    Thanks in advance.

  11. MyAvatars 0.2 Dav Glass Says:

    @AJ –

    Here is an example of doing that:
    http://blog.davglass.com/files/yui/cal2/more.php

  12. MyAvatars 0.2 AJ Says:

    Ahh, the answer is always the easier option. Thank you, I went at it the long long way :) This works perfect.

  13. MyAvatars 0.2 Blue Says:

    Do you think we need such a big piece of code to achieve the tooltip..Here is another thought..

    var arr = { ‘6/30/2007′:’This is the 7th of June’,
    ‘6/23/2007′:’This is one more day’};

    var tooltip = function(e){
    var ab = cal1.getDateFieldsByCellId(e.target.id);
    var b = ab[1]+”/”+ab[2]+”/”+ab[0];
    if (arr[b])
    new YAHOO.widget.Tooltip(’tt’,{context:e.target.id,
    text:arr[b]});

    }

    YAHOO.util.Event.addListener(’cal1′, “mouseover”, tooltip);

    THnks
    Blue

  14. MyAvatars 0.2 Blue Says:

    I was checking with IE .it does n\\\’t work .Here is a tweak..

    var arr = { ‘6/30/2007′:’This is the 7th of June’,
    ‘6/23/2007′:’This is one more day’};

    var tooltip = function(e){
    var id =\\\”\\\”;
    if(e.target)
    id = e.target.id;
    else
    id = e.srcElement.id;
    endif;
    var ab = cal1.getDateFieldsByCellId(e.target.id);
    var b = ab[1]+”/”+ab[2]+”/”+ab[0];
    if (arr[b])
    new YAHOO.widget.Tooltip(’tt’,{context:e.target.id,
    text:arr[b]});

    }

    YAHOO.util.Event.addListener(’cal1′, “mouseover”, tooltip);

  15. MyAvatars 0.2 Chonli Says:

    Hi, i’m using your example of YUI: Calendar Row Selection with no results.I’d like to know if it’s possible to select a range of dates like here:http://www.hoteldoncarlos.com/reservas.phpThanks in advance,Chonli

  16. MyAvatars 0.2 Dav Glass Says:

    Chonli –

    Currently the Calender doesn’t support range selection, but a bug has been filed for it:
    http://sourceforge.net/tracker/index.php?func=detail&aid=1670139&group_id=165715&atid=836479

    It wouldn’t be that hard to get this to work, I may try to take a stab at it if I get some extra time..

© 2008 Dav Glass - All content is mine, except comments. Comments are the property of the poster. I speak for no person or company.
Can you tell me what this says? 01000100 01100001 01110110 01101001 01100100 00100000 01000111 01101100 01100001 01110011 01110011