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

confused with API

Expand Messages
  • matthew_be
    Hi, sometimes I am confused with the YUI API, here is an example with selectEvent from Calendar, in the docs it says it recieves one single parameter, but in
    Message 1 of 2 , Sep 2, 2008
    • 0 Attachment
      Hi,

      sometimes I am confused with the YUI API,
      here is an example with selectEvent from Calendar,
      in the docs it says it recieves one single parameter,
      but in the example code there are 3 parameters.

      FROM DOCS:
      selectEvent
      selectEvent ( Array )
      Fired when a selection is made

      Parameters:
      Array <Array> of Date field arrays in the format [YYYY, MM, DD].

      FROM EXAMPLES:
      selectEvent - Fired after a date selection is made. This event
      receives one argument -- an array of dates fields in the format:
      [[yyyy,mm,dd],[yyyy,mm,dd]]

      FROM EXAMPLE CODE:
      function mySelectHandler(type,args,obj) {
      var selected = args[0];
      var selDate = this.toDate(selected[0]);
      [...]
      };
      YAHOO.example.calendar.cal1.selectEvent.subscribe(mySelectHandler,
      YAHOO.example.calendar.cal1, true);

      (And by the way, why this semi-colon after the handler functions ?)

      Thank you for any advice
    • Satyam
      It sounds somewhat confusing but the doc and example do match. Perhaps this would make it clearer (the blue is my addition). Parameters: Array of Date
      Message 2 of 2 , Sep 2, 2008
      • 0 Attachment
        It sounds somewhat confusing but the doc and example do match.

        Perhaps this would make it clearer (the blue is my addition).

        Parameters:
        Array <Array> of Date field arrays [where each entry is]in the format [YYYY, MM, DD].

        There is a further level of array in the listener due to the way the
        Event Provider passes the arguments.

        Satyam


        matthew_be wrote:
        > Hi,
        >
        > sometimes I am confused with the YUI API,
        > here is an example with selectEvent from Calendar,
        > in the docs it says it recieves one single parameter,
        > but in the example code there are 3 parameters.
        >
        > FROM DOCS:
        > selectEvent
        > selectEvent ( Array )
        > Fired when a selection is made
        >
        > Parameters:
        > Array <Array> of Date field arrays in the format [YYYY, MM, DD].
        >
        > FROM EXAMPLES:
        > selectEvent - Fired after a date selection is made. This event
        > receives one argument -- an array of dates fields in the format:
        > [[yyyy,mm,dd],[yyyy,mm,dd]]
        >
        > FROM EXAMPLE CODE:
        > function mySelectHandler(type,args,obj) {
        > var selected = args[0];
        > var selDate = this.toDate(selected[0]);
        > [...]
        > };
        > YAHOO.example.calendar.cal1.selectEvent.subscribe(mySelectHandler,
        > YAHOO.example.calendar.cal1, true);
        >
        > (And by the way, why this semi-colon after the handler functions ?)
        >
        > Thank you for any advice
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - http://www.avg.com
        > Version: 8.0.169 / Virus Database: 270.6.14/1645 - Release Date: 01/09/2008 7:19
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.