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

calendar cell mouseover function runs upon cell render but not on mouseover

Expand Messages
  • osirishinzen
    Hi All, I hope someone can help me with the calendar widget I would like to fetch data associated with a date when a user mouseover s a date. Here s what my
    Message 1 of 4 , Mar 2, 2006
    • 0 Attachment
      Hi All,

      I hope someone can help me with the calendar widget

      I would like to fetch data associated with a date when a user
      mouseover's a date.

      Here's what my code looks like

      ***********************
      var cal1;

      function fnTest (cell) {
      alert(cell);
      }

      function renderWithEvent(thedate, cell) {
      YAHOO.widget.Calendar_Core.addCssClass(cell, 'test');
      YAHOO.util.Event.addListener(cell.id, "mouseover", fnTest(cell));
      }

      function init() {
      cal1 = new YAHOO.widget.Calendar("cal1","calendarCell");
      cal1.addRenderer("3/10/2006",renderWithEvent);
      cal1.render();
      }
      ***********************

      I used the addListener utility to associate a function with the cell's
      mouseover event but if you try the code above you will see that the
      function fnTest executes as the cell is being rendered and the
      mouseover does not work.

      Any help is most appreciated.
    • osirishinzen
      I think the answering your own post syndrome is contagious. It seems I should not pass the object as a parameter like this
      Message 2 of 4 , Mar 2, 2006
      • 0 Attachment
        I think the "answering your own post" syndrome is contagious.
        It seems I should not pass the object as a parameter like this

        YAHOO.util.Event.addListener(cell.id, "mouseover", fnTest(cell));

        instead it should look like this

        YAHOO.util.Event.addListener(cell.id, "mouseover", fnTest, cell);

        and it works !!!!
      • osirishinzen
        Spoke too soon, the object beeing passed is the mouseevent object not the date or cell object which I need. :(
        Message 3 of 4 , Mar 2, 2006
        • 0 Attachment
          Spoke too soon, the object beeing passed is the mouseevent object not
          the date or cell object which I need. :(

          --- In ydn-javascript@yahoogroups.com, "osirishinzen"
          <osirishinzen@...> wrote:
          >
          > I think the "answering your own post" syndrome is contagious.
          > It seems I should not pass the object as a parameter like this
          >
          > YAHOO.util.Event.addListener(cell.id, "mouseover", fnTest(cell));
          >
          > instead it should look like this
          >
          > YAHOO.util.Event.addListener(cell.id, "mouseover", fnTest, cell);
          >
          > and it works !!!!
          >
        • Nige White
          ... The object is passed as the second parameter - after the event.. _____________________________________________________________________ This message has
          Message 4 of 4 , Mar 2, 2006
          • 0 Attachment
            osirishinzen wrote:

            > Spoke too soon, the object beeing passed is the mouseevent object not
            > the date or cell object which I need. :(

            The object is passed as the second parameter - after the event..

            _____________________________________________________________________
            This message has been checked for all known viruses. Virus scanning
            powered by Messagelabs http://www.messagelabs.com For more information
            e-mail : hostmaster@...
          Your message has been successfully submitted and would be delivered to recipients shortly.