views:

986

answers:

4

I'm looking for a DataGrid with expandable rows implementation in Flex. I don't want to use Advanced DataGrid control because it's too slow and too complex.

The desired behavior is like this: when you click a row, a panel opens between the rows with some details and the rest of the rows are moved down, and when you click again the panel is closed and the rows are back to normal. If you click the other row, the one that was expanded collapses and the row you clicked is expanded.

A: 

You'll probably need to use a custom ItemEditor that responds to clicks and expands itself.

The variableRowHeight property may need to be set to true as well.

CookieOfFortune
He didn't mention editing. Also the problem with the DataGrid is that it doesn't have a renderer for the entire row, it has renderers for each of his columns. So he needs to either find a way to insert the details panel between the row, or have each renderer display a part of the additional details, which would make it look ugly, to say the least...
bug-a-lot
That's why you use an ItemEditor instead of an ItemRenderer. An ItemEditor only shows up when you click on the cell.
CookieOfFortune
I'm sorry, I still don't see how that would help. Unless you can make the itemEditor not be constrained by columns and appear under the clicked row, without obscuring the next one.
bug-a-lot
I think to span the solution across all the columns, a custom itemRenderer would be required as well. I suppose it can all be done with a custom ItemRenderer. I'd say it's probably just easier to use an AdvancedDataGrid.
CookieOfFortune
The problem with AdvancedDataGrid is that it's too slow. I've switched to Flex DataGrid because the one I used was very slow. But thanks for your answer any way.
Alexander
A: 

The behavior you are describing sounds an awful lot like an Accordion component, though that doesn't quite sound like what you are looking for. Another approach would be to use a List component with a custom itemRenderer that is expanded when in the selected (clicked) state, and collapsed when not selected.

Wade Mueller
We already found the solution. We extended and customized the Flex DataGrig for this.
Alexander
A: 

We extended Flex Datagrid component and used custom item renderer for this. We actually expand one cell and resize it to cover all other cells in the same row. While this may be not the easiest solution it works and the Datagrid is very fast.

Alexander
Why do you say that the advanced datagrid is too slow? If I correctly understand the initial question, you would be able to get the desired result fairly easy with an advanced datagrid without performance issues
Pieter van Niekerk
A: 

Hi there,

I am searching for this solution for a while, could you please add some code example to your solution because i didn't exactly understand how to implement this....

i could implement this by a List or other components, but i need the datagrid...

seismael