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

[ydn-javascript] contextual oncontextmenu

Expand Messages
  • Kenny
    Todd - I have a similar scenario, but the content is available as markup. Below mentioned approach holds good or is there any finest approach ?!. Please
    Message 1 of 6 , Jan 31, 2007
      Todd -

      I have a similar scenario, but the content is available as markup.
      Below mentioned approach holds good or is there any finest approach ?!.

      Please advice.

      Thanks,
      Kenny


      Todd Kloots <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
      fired.

      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.
      >
      > Thanks,
      > Michael
      >
      >
      >
      > Yahoo! Groups Links
      >
      > (Yahoo! ID required)
      >
      > mailto:ydn-javascript- fullfeatured@ yahoogroups. com
      >
      >
      >
      >
      >
      >



      Never miss an email again!
      Yahoo! Toolbar
      alerts you the instant new Mail arrives. Check it out.

    • 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 2 of 6 , Jan 31, 2007
        That makes perfect sense and is an absolutely terrific solution.  I always forget that I can subscribe to those "interesting moments".

        Thanks!
        Michael

        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
        fired.

        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.