View Full Version : Tree implementation

30 Nov 2006, 3:29 PM
It's official. The new tree view is a go. They agreed to contribute to part of the development, which is a good start. (Yes, Herm additional contributions definitely help. Thank you!)

Here is the current list of requirements:

- MVC DataModel approach like the grid to support data from different data source types and structures (and building from existing markup)

- lazy loading and rendering

- Full Drag and Drop ordering/moving support with ghosting, illegal drop indicator, "slow repair" when dropped in illegal spot, drop point indicators, expansion of nodes on drag over

- multi/single selection models

- keyboard support

- fully customizable via CSS

- Integrated state management

Nice to haves:
- Built in context menu support

- Animated transitions

There will of course be a ton of events like the grid.

Like the grid and editing, I'm sure there will be a second version with:

- Inline editing
- Integrated checkbox support

After I finish a small project I am working on and get back from a training trip (next week), this will be the top priority!

If you have any other suggestions, now is the time. :)

30 Nov 2006, 4:23 PM
Encapsulated search

myTreeNode.search(Criteria string or regex, stuff: {id, textlabel, href etc}, Boolean loadUnloadedChildren ) : Array of tree nodes
Searches the stuff attributes of the current node and its loaded children (and optionally its unloaded children) and gets the treenodes matching the search criteria.

30 Nov 2006, 4:33 PM
Not a bad idea. loadUnloadedChildren would be tricky (and require the most work) since it would have to be asynchronous with a callback rather than returning the matches. Also, nodes on different branches would be loaded separately and require synchronization? I'd have to think about that.

30 Nov 2006, 5:00 PM
That param is no biggie - ok to lose it and just search whatever is loaded. BTW a search method/function would be a rich capability to have across the board. A bit like an Observable with a MixedCollection.find/findAll. A Searchable.Search :D

30 Nov 2006, 5:12 PM
This is great to hear jack, I've been hacking away at the YUI tree for quite some time now to get node selection, drag+drop and context menu working.

I think it'd be cool to support (or make it easy to support) run-time filtering that does not destroy the current open/closed state of each group in the tree.

So for example if you have this tree:

+-- Bldg 1
| +-- Floor 1
| +-- Room 1
| +-- Room 2
| +-- Room 3
+-- Bldg 2
and you apply a (regex) filter "name contains 3" on the leaf nodes and end up with:

+-- Bldg 1
+-- Floor 1
+-- Room 3
Most tree views suck at this kind of thing as they will simply reload the filtered data, redraw the entire tree view and show a collapsed tree.

+-- Bldg 1

1 Dec 2006, 5:43 AM
Without loading unloaded children that should be a piece of cake. I will definitely encapsulate/extract the DataModel search functionality and make it reusable.

arnair the filter logic goes hand in hand with search so it will find it's way in. :) Alos, since I'm sure the tree will use context sensitive rendering (like the grid) I don't see any reason expand/collapse state wouldn't be maintained.

1 Dec 2006, 10:07 AM
IŽd like to see an treegrid, joining both capabilities, something like this(incredible but commercial):
Althoug this is another subject, to have this libraries available for java server faces would be astonishing, because I don't know anything remotely comparable to what you are doing!!...
Sorry for my English

1 Dec 2006, 10:17 AM
I was just about to request the same thing .. trees with data columns.

Otherwise it would be nice if grids have a "group by" functionality - but that's a different subject.

I wonder how much you require for this request ... maybe many of us cood pool our money to request some features from Jack :D

1 Dec 2006, 11:40 AM
The pool idea definitely works for me. :D

I think the best part about yui-ext is how we can do incremental releases with feedback and the "build and improve as you go" philosophy. In the end I think it will beat out the more standard approach of build and release the kitchen sink.

8 Dec 2006, 1:02 PM
Cannot wait for it! Drag-drop node in the tree will be big plus!

9 Dec 2006, 7:09 AM
- Built in context menu support

Multiple context menu:
- based of selected node when right clicking
- fire a command to load a context menu from the server using the selected node as parameter



9 Dec 2006, 7:28 AM
Sound great this proyect, i wish participate. Dont forget the icons, must be fully user customizable for each node, i think ;-)