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

Re: [ydn-javascript] Re: Adding Nodes to a tree from the screen.

Expand Messages
  • Satyam
    That is not specifically related to the TreeView, it is completely up to you how you want to design it. You would probably use something derived from the
    Message 1 of 6 , Sep 29 12:58 PM
    • 0 Attachment
      That is not specifically related to the TreeView, it is completely up to
      you how you want to design it. You would probably use something derived
      from the SimpleDialog component of the Container set of widgets to ask
      for the label. How to pop that up? Well,
      - you can respond to the labelClick event of TreeView to identify the
      node clicked and pop up the dialog asking for the label,
      - you can use the ContextMenu to pop a floating menu and pick some sort
      of Add Node (or whatever you want to call it) option.
      - you can put an icon next to the node labels to pop up the add node
      dialog window
      - You can also drag and drop elements from a list elsewhere.

      As I said, none of those options are specific to TreeView, it is up to
      you which one you want. Once you decide what's better from the user's
      perspective, you will certainly find someone to help you with that,
      though it's not going to be me since I know little of any of those other
      components.

      Satyam


      gymscijo wrote:
      > thanks for the reply
      > I have confusion.
      > Suppose I have a tree like this
      >
      > 1
      > 2
      > 2.1
      > 2.2
      > 2.2.1
      > 3
      >
      > If I need to add a new node under 2.2, how will the user type the node
      > name from the screen? Is there any thing like drag and drop functionality
      >
      >
      > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
      >
      >> Not much there to show, simply add a node in the usual way, like:
      >>
      >> var tmpNode = new YAHOO.widget.TextNode('something', whereToHangItFrom);
      >>
      >> And then call method draw() again.
      >>
      >> You can add several nodes at once and call draw just at the end of it
      >> all, you can add one, redraw once, add another, redraw again and so on.
      >>
      >> Instead of calling draw() and have the whole tree redrawn each time
      >> after you create each new node, you can do it a little more
      >> sophisticated by calling method getEl() on the node you just appended
      >> the new node to and set its innerHTML property to the result of
      >> getNodeHtml() (of the parent, not of the new child). If the tree is
      >> really big that will be faster and flicker free. Basically, that is
      >> doing at the node level what draw does at the tree level (If you check
      >> the first few lines of method draw, that is basically what you see).
      >>
      >> Satyam
      >>
      >>
      >> gymscijo wrote:
      >>
      >>> Do you have any code samples for this, that I can refer.
      >>> My requirement is once the tree is loaded, the user will be adding new
      >>> nodes to the tree from the loaded page and save it. The new values
      >>> will be saved to database. So reloading is not a problem.
      >>>
      >>>
      >>> --- In ydn-javascript@yahoogroups.com, Satyam <satyam@> wrote:
      >>>
      >>>
      >>>> Yes, at any time, but you have to render the tree again for them to
      >>>>
      >>>>
      >>> show.
      >>>
      >>>
      >>>> Satyam
      >>>>
      >>>>
      >>>> gymscijo wrote:
      >>>>
      >>>>
      >>>>> Is it possible to add the nodes from the screen once tree is loaded.
      >>>>>
      >>>>>
      >>>>> ------------------------------------
      >>>>>
      >>>>> Yahoo! Groups Links
      >>>>>
      >>>>>
      >>>>>
      >>>>>
      >>>>>
      >>>>>
      > ------------------------------------------------------------------------
      >
      >>>
      >>>
      >>>>> No virus found in this incoming message.
      >>>>> Checked by AVG - http://www.avg.com
      >>>>> Version: 8.0.169 / Virus Database: 270.7.3/1693 - Release Date:
      >>>>>
      >>>>>
      >>> 26/09/2008 7:35
      >>>
      >>>
      >>>>>
      >>>>>
      >>>
      >>> ------------------------------------
      >>>
      >>> Yahoo! Groups Links
      >>>
      >>>
      >>>
      >>>
      >>>
      > ------------------------------------------------------------------------
      >
      >>> No virus found in this incoming message.
      >>> Checked by AVG - http://www.avg.com
      >>> Version: 8.0.169 / Virus Database: 270.7.5/1696 - Release Date:
      >>>
      > 28/09/2008 13:30
      >
      >>>
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - http://www.avg.com
      > Version: 8.0.169 / Virus Database: 270.7.5/1696 - Release Date: 28/09/2008 13:30
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.