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

Re: [ydn-javascript] contextual oncontextmenu

Expand Messages
  • Michael Winston
    That makes perfect sense and is an absolutely terrific solution. I always forget that I can subscribe to those interesting moments . Thanks! Michael
    Message 1 of 6 , Jan 31, 2007
    • 0 Attachment
      That makes perfect sense and is an absolutely terrific solution.  I always forget that I can subscribe to those "interesting moments".


      On Jan 30, 2007, at 11:54 AM, Todd Kloots wrote:

      Michael -

      If you set the "lazyload" configuration property to
      "true" for your ContextMenu, then its contents will
      not get created and the menu itself will not be
      rendered until the "contextmenu" event is actually

      That said, if you're creating a ~1000 elements with
      unique context menus, then, yes it would be better to
      reuse a single ContextMenu instance and reuse it. You
      can subscribe to your context menu's "showEvent" and
      use the "contextEventTarget" to determine what child
      node was the actual target of the "contextmenu" event
      that triggered the display of the menu. You can then
      use that target element to determine what content you
      need to add or remove from the menu.

      Make sense?

      - Todd

      --- Michael Winston <michaelw@darkhorse.com> wrote:

      > Let's say I have 1000 different nodes and each one
      > could have a
      > custom contextual menu (using YUI Menu, of course).
      > I'm a little
      > worried about the performance efficiency of building
      > 1000 individual
      > contextmenus (lazyloaded or not) on the chance a
      > user might actually
      > want to use one or two of them. This is especially
      > true since some
      > number of the menus might need to be built with AJAX
      > calls.
      > So what I'd like to do is just attach an
      > 'oncontextmenu' listener to
      > those 1000 nodes that will dynamically build,
      > render, and override
      > the browser's contextmenu.
      > Is this possible and, if so, how?
      > If not, it would be great to know that it's
      > impossible.

    Your message has been successfully submitted and would be delivered to recipients shortly.