PDA

View Full Version : Datagrid With Tree ItemRenderer


brixel
11-11-2008, 05:55 PM
I'm looking for some advice on using the tree component as an item renderer in one of my columns in a datagrid to show a tree structure.

I've got the data in the grid, Ive got the tree item renderer setup, etc, but expanding and collapsing the tree doesn't shift the row height in the grid back and forth.

For starters, just keeping everything default and pushing a tree component in as the item renderer, the row heights are very tall, to compensate for the exapnsion of the tree I assume.

I've tried the only code I could find that comes close to solving the issue located at:

http://www.flex888.com/712/datagrid-with-flexible-row-height.html

This doesn't function properly, though the example appears to be, but he is missing code in his example.

Has anyone done this before? It seems so straight forward, or at least it should be. The datagrids variableRowHeight appears almost useless. I just want the row heights in the grid to maintain themselves with the expansion and collapse of the tree. Any help would be greatly appreciated.

rebelheart
11-11-2008, 08:02 PM
What you are trying to do seems like a tree grid. There are some examples online or you could also check the 'advanced datagrid' in flex 3 at livedocs.Check out it's code from flex 3 sdk. That one does a similar thing.Google flex lib or whatever that is called, has a component like this.

Conceptually, what you need to do is check for the 'data' in the itemrenderer, which should contain the entire row of data from the grid,basically an object .If that has a child collection that you are looking for, then expand/collapse the parent collection based on an event [say click on the icon in the renderer or whatever] .

I am sure that wasn't very helpful, but that's just an outline. Without the actual code not much can be said.I did something like that myself, I will see if I can get that up here.

brixel
11-11-2008, 08:05 PM
Thanks for the reply.

Yeah, Im not looking for the hierarchy view that the Advanced DataGrid is capable of. I have my tree data in and communicating already to my item renderer, the problem is simply row height in the DataGrid.

I need the individual row heights to dynamically expand and contract as the tree opens and closes.

The code from the link I posted below works with the Advanced DataGrid, just not the regular DataGrid.