dbtreeview - set node?

With the dbtreeview, is there a way to expand to a particular node, to ensure that it shows in the tree?

F’rinstance, I may have a node four levels down; if I get there through the tree, it’s obvious how I got here and where else I can go in the tree. If I get there some other way, though (through a method, or other navigation, or whatnot), the tree is collapsed and I can’t see where I am.

What I’m looking for here is to create a visual cue in the dbtreeview, not just to trigger the method associated with the node. (I know how to do that.)

How do you suggest you target a treenode in javascript on the bean?

I’ve absolutely no idea. Perhaps setting an attribute of the dbtree element, or calling one of its functions?

I thought perhaps I wasn’t seeing an option. Perhaps it just isn’t an option at all. If not, could it ever become one?

Currently it is not an option, but the difficulty is in defining a way to pin point a node in the tree.
Based on row pk? UI wise?

Based on row-pk is fine with me!
If that gives me a way to open a node by method than I say: Hoera! :)

Servoyans…Any movement on this?

Ideally, we would like to be able to programatically do the equivalent of both single click (just select) and double click (expand). Select by node pk would be fine. Select by node label ‘path’ (Setup:Company:Notes) would be good, too.

Best would be select by a unique integer key other than the node pk, so that if one changed the design of the tree, one could keep this new id the same for a given leaf.

JerryR:
Servoyans…Any movement on this?

Ideally, we would like to be able to programatically do the equivalent of both single click (just select) and double click (expand).

Yep, we really do need this. More thought…

There are times when you want to expand or contract the tree but not change the record selection. Clicking on the open/close switch (icon depends on LAF) only affects the tree display and not the selection. This is useful behavior. You have to click the actual file icon to change the selection. Double clicking it affects the selection and opens or closes the tree. The best solution would allow programmatic control of both the tree and the selection.

Now, if you allow the tree to change without changing the record selection, pk no longer works for everything. Using “Setup:Company:Notes” as a way to map the tree might be difficult as that would require you to keep up with the labels. Perhaps a simple dot scheme would work. For example, this would conciseley describe a tree or rather a set of items in a tree:
1:1
1:1:1
1:1:2
1:2
1:3
1:3:1
1:3:1:1
1:3:1:2
…etc.

If each of these nodes were addressable this way, you could do stuff like,
elements.dbtreebean.nodeOpen(1:3:1) = true;

We’d also then like to be able to manage the set of items via an index where the index starts at 1 for a fully expanded tree, i.e. nodeIndex 3 would be node 1:1:2. We’d like to be able to also get node PK (1:1:2) or the inverse, get node position by pk and have it return the tree position. Then we could get or set its status as opened or closed.

To change a record selection, ideally we would first change the actual record index in the foundset and then change the tree to show that record as selected. As long as it is actually selected, the tree would then show it as selected.

The next release of the dbtreeview will support get and set selection node based on an array of pks (path)

Jan Blok:
The next release of the dbtreeview will support get and set selection node based on an array of pks (path)

That sounds most excellent, Jan. When a “set” is made (by pk), will the tree automatically refresh with that node selected and also “open it” if needed?