Parent/child

I have seen a Telerik grid control that for each row (not cell), you can drop down a "child" control with additional metadata/controls in it. This child control can be just about anything. I'm wanting something like a panel that has tabsheets in it for example where each tab would contain additional metadata fields in it that relate to the parent grid row. The rows would separate from each other so the child would fit between the rows...i.e., the child control would not just lay on top of the other rows in the grid. All rows are still visible. Does TMS have anything like that for Delphi 2007? I so far haven't found anything but I could be missing something. I know there are dropdown edit controls for cells, but that is not what I'm after.



Thanks!



You could do this using CellControls, you can insert any control in a grid cell using grid.CellControls[],
The cell controls technique is described at:
http://www.tmssoftware.com/site/asg57.asp

Interesting! I'll take a look. Thanks!

This is working out well using nodes. I do have one question that I can't seem to figure out. I am using glyphs for the expand/contract symbols and they work fine with 1 fixed column. Now I want to add a row indicator in another fixed column and I want that to be in column 1 and the expand/contract glyph in column 2. I can't seem to make that happen, it appears the expand/contract glyph is always in the leftmost fixed column as is the row indicator (glyph seems to win over row indicator). Can I control what fixed column the expand/contract glyph appears?

Sorry, cell nodes are always in the first column (column 0)

ok thanks!

Upon deeper inspection, we can relatively easy add support for nodes in a different column and we're looking at adding that feature for the next release.

Nice!

One other question related to nodes. I want to implement sorting on one or maybe 2 columns but I only want the sort to be performed on the parent rows of the grid and not look at the child nodes. I've read a thread about using grouping but that is not an option for me. I have the sorting being done in-code currently by using a checkbox to initiate the sort and I only look at the parent rows but it would be nice to use the built in click on column header to initiate sorting and having the up/down sort direction arrows in the header row. Does the customcompare event play into this?

When nodes are used, it is only possible to sort child nodes of parent rows but unfortunately, there is currently no built-in support to sort parent rows (I assume you want to have child rows move along with the moving sorted parent rows?) 
You'd need to remove the groupin first, perform a sort and then regroup. You can limit sort on a selection of columns with the grid.QSortIndexed where you add the indexes of the columns to sort on via the grid.SortIndexes list.

Another follow up question. It has to do with having a node expanded and the child row is being displayed. The issue occurs when the grid has it's horizontal scrollbar enabled and I scroll the grid off to the right where the far left columns are not visible, the child row doesn't redraw and is totally blank. If I then scroll back to the left where the far left columns are visible then the child row comes back. Is this by design? I'm thinking it has something to do with start column in the MergeCells call.



You can see this behavior in the TAdvStringGrid demo app asg57. Just shrink the size of the grid control up to where it has the horizontal scrollbar visible.

This is related to using cell controls. A cell control can't be partially hidden. It's visibility is controlled by the visibility by the topleft cell of a merged cell, so if that topleft cell becomes invisible , the cell control also becomes invisible.

Ok...so one more question. How can I keep someone from scrolling the grid past a certain column so this doesn't happen? If my cell control starts in column 3 then I don't want the user to scroll past column 3 where everything disappears. I saw an event called OnScrollCell but can't seem to figure that one out and it looks like it may only work for vertical scrolling, not horizontal. Is this possible using events currently available to the grid?



Thanks!

Sorry, there is unfortunately not a built-in setting to stop a user from scrolling till the right-most column.