Making a node expandable without adding children

Issue #19 resolved
Jonathan Nightingale created an issue

This is a great widget, and I’ve found it easy to use.

A question though: I have a dynamic tree, and fill the children of a node in when that node is expanded, in the onExpansionChanged callback, which in itself is working well.

However a node is only expandable in the first place if the children list is non-empty; at the moment I’m hacking this by adding a placeholder node, but what is the recommended way of handling this?

I can’t think of clean way other than filling in the children at the level above - but in my case this would mean fetching more data than I really want to.

Thanks,

Jon

Comments (3)

  1. Kevin Armstrong

    Hi Jonathan. I’m glad the widget is working well for you.

    There currently isn’t a clean way to perform this functionality. In fact, as I was reading this issue, my immediate thought was to place a node in the children array to allow the node to be expanded just as you did.

    What I will do is add a property that will force the node to be a parent that can be expanded. That will be a fairly easy update that I should be able to publish later today.

  2. Jonathan Nightingale reporter

    That would be brilliant, thanks. There’s no big rush from my side, but if you do add it I’m happy to pick it up and use it.

    Thanks again,

    Jon

  3. Kevin Armstrong

    Fixes issue #18 - introduced vertical and horizontal spacing Fixes issue #19 - added parent flag to Node to force parent layout Fixes issue #22 - fixed various styling properties with the TreeNode and TreeViewTheme

    → <<cset 1ec5b6375bb8>>

  4. Log in to comment