Google Closure Library - Adding non-TreeNode children to a TreeNode

Posted by Andreas Jansson on Stack Overflow See other posts from Stack Overflow or by Andreas Jansson
Published on 2010-04-16T14:44:16Z Indexed on 2010/04/16 16:43 UTC
Read the original article Hit count: 576

Hi,

I'm using the Google Closure Library and goog.ui.tree in particular to build a tree structure GUI component. It works pretty well out of the box, but I'd like to add a few extra controls to each of the leaves (goog.ui.Checkboxes in particular).

The problem is that Component.addChild has been overridden in BaseNode so that each added child is treated as a child tree node as opposed to a child component. In effect plenty of errors are thrown if you try to add anything else than an actual tree node as a child, as these children are traversed and BaseNode-specific functions are called on them.

I must admit I'm quite a Closure newb, but I reckon there must be some workaround for this, right? Essentially all I want to do is have a bunch of checkboxes appear next to each leaf in my tree.

Thanks, Andreas

© Stack Overflow or respective owner

Related posts about google-closure-library

Related posts about tree