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

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

Expand Messages
  • Satyam
    Nov 1, 2008
      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
      >
      >
    • Show all 5 messages in this topic