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

Re: [ydn-javascript] Multiple use of widget on one page

Expand Messages
  • Satyam
    You can set the same listener for several objects. Within the listener, Event getTarget method lets you find what was clicked, possibly by its id. Methods
    Message 1 of 5 , Nov 1, 2008
    • 0 Attachment
      You can set the same listener for several objects. Within the listener,
      Event getTarget method lets you find what was clicked, possibly by its
      id. Methods getXY and setXY let you find out the position of the button
      and move the calendar container to the clicked button. You would need
      some consistent naming convention for the element IDs to associate
      calendar buttons to the input element where the selected date should go.

      You can actually have a single click listener for the whole
      document.body and through the getTarget call find out what was clicked
      and if it wasn't one of the calendar pop up buttons you simply ignore
      it. You can use, for example, a className to signal buttons that are
      meant to pop up calendars all across your application so whether there
      is one or many calendars or even if you add/remove them in the future,
      you always set up a single listener and a single calendar to serve any
      number of calendar pop ups buttons.

      Satyam




      akujbida wrote:
      > Is there a tidy approach to putting many widgets (in this case,
      > calendar menu buttons)onto one page? I need 12 or more, and this adds
      > up to a lot of redundant code. I think that one part of a tidy
      > solution would require that the ID of the clicked calendar gets passed
      > to the select handler, but this does not seem to be the case.
      >
      > I can't find this resolved anywhere in the forum, tips appreciated.
      >
      > Sincerely,
      > Aleksander
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - http://www.avg.com
      > Version: 8.0.175 / Virus Database: 270.8.5/1759 - Release Date: 31/10/2008 16:10
      >
      >
    • bretlevy
      Aleksander: This might help you... http://sandbox.bluelinkdemo.com/sandbox/caltest1.htm ~~bret
      Message 2 of 5 , Nov 1, 2008
      • 0 Attachment
        Aleksander:

        This might help you...

        http://sandbox.bluelinkdemo.com/sandbox/caltest1.htm

        ~~bret


        --- In ydn-javascript@yahoogroups.com, "akujbida" <akujbida@...> wrote:
        >
        > Is there a tidy approach to putting many widgets (in this case,
        > calendar menu buttons)onto one page? I need 12 or more, and this adds
        > up to a lot of redundant code. I think that one part of a tidy
        > solution would require that the ID of the clicked calendar gets passed
        > to the select handler, but this does not seem to be the case.
        >
        > I can't find this resolved anywhere in the forum, tips appreciated.
        >
        > Sincerely,
        > Aleksander
        >
      • akujbida
        Thanks Satyam, That is a superb overview of the approach, just what I needed, thanks for taking the time. Sincerely, Aleksander ... listener, ...
        Message 3 of 5 , Nov 1, 2008
        • 0 Attachment
          Thanks Satyam,
          That is a superb overview of the approach, just what I needed,
          thanks for taking the time.
          Sincerely,
          Aleksander

          --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
          >
          > You can set the same listener for several objects. Within the
          listener,
          > Event getTarget method lets you find what was clicked, possibly by its
          <snip>
        • akujbida
          Thanks Bret, I had noticed that one when looking earlier, but couldn t figure out how to apply it to the menubutton style of calendar, so kept looking. Very
          Message 4 of 5 , Nov 2, 2008
          • 0 Attachment
            Thanks Bret,
            I had noticed that one when looking earlier, but couldn't figure
            out how to apply it to the menubutton style of calendar, so kept
            looking. Very neat and tidy, though, and will be the route I will try
            to take. Thanks for troubling to point it out.
            Sincerely,
            Aleksander

            --- In ydn-javascript@yahoogroups.com, "bretlevy" <bret@...> wrote:
            > Aleksander:
            > This might help you...
            > http://sandbox.bluelinkdemo.com/sandbox/caltest1.htm
            > ~~bret
          Your message has been successfully submitted and would be delivered to recipients shortly.