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

4548TextView Does Not Integrate Well

Expand Messages
  • alex.pooley
    Sep 3, 2006
    • 0 Attachment
      My experience so far with TextView has shown that it does not
      integrate well with the rest of YAHOO user interface library.

      I've found three ways I could attach event handling to nodes in a
      TreeView, and none of them work properly. All my current problems stem
      from having to run the refresh() function as I add/remove nodes from
      the dynamic tree.

      1) addListener via the YAHOO.util.Event system does not work because
      on refresh() of the tree, event handling added to the treeview nodes
      are overwritten. This is made worse in that I want to attach a context
      menu to each node, and these bindings appear to be lost after refresh.

      2) The recommended method is to modify the href property of the node.
      That way when refresh is called, your event handler is included. But,
      to work with this system you have to write strings instead of simply
      attaching first class function objects and so you lose the power of
      closures. It's yuck. Besides, javascript in href's is bad form yeh?
      Plus, I'm not sure how I would add my context menu listeners this way,
      but I know that I shouldn't have to know either :)

      3) Alternatively it's possible to hook in to the expanded and
      collapsed events that are distributed by the TextView. But I need the
      'click' event and these events are too high a higher level. For
      example, I need to trigger the context menu which has nothing to do
      with expansion/contraction of the treeview nodes.

      Thought anyone?