I'm wanting to have collapsable rows within my virtual grid (Like the Hierachy. After thinking about it, it seems unreasonable to expect the virtual grid to do it for me, but is there any way for me to specify a row is a collapsable row?
Does anyone have any ideas how I can do this? ( I can only think of overriding drawing the cell and catching the click event )
The \grid\samples\in depth\virttreegrid samples has collapsible rows in a virtual grid.
SHSue HarrisMarch 27, 2003 01:53 AM UTC
When I looked at that sample, it was still had some bound data ( which it seemed to use as the guide to the hierarchy ), whereas my grid is entirely virtual, populated using the GridQueryCellInfo event. Is there something I can set in the Style that indicates it is a child or has children? Or am I missing something obvious?
AdministratorMarch 27, 2003 01:40 PM UTC
The VirtTreeGrid sample has a custom TreeCell type where it uses the Tag to indicate an indentation level. Simarily, you could use the Tag to indicate whether this row has a child or not. If you want to track 2 state properties, like indentation level and whether the row has a child, you could derive a class to hold these properties and set the Tag to instances of your derived class. You would have to get the values for this extended Tag property for your external data source. (And this is the hard part. Ie, given a row, return whether it has a child, and how many parents does it have so you can draw the header properly).
SHSue HarrisMarch 27, 2003 08:26 PM UTC
Excellent, your suggestion has helped me solve the exact problem. (I was looking at the wrong sample to start with which is why I was so confused).