Hi,
I am trying to create 3 individual panels inside xamdatagrid. Basically I have 20 columns which are grouped as 4 columns, 8 columns and 8 columns in the 3 panels. each panel can be expanded left/right using a splitter control. Also each panel would have a horizontal scrollbar. Is it possible with the xamdatagrid and if so can someone please let me know how?
Thanks,
Harsh
Hi Alex,
Sorry for the delay. Was on vacation on Thanksgiving. Here is the method I had:
private
sTag)
{
b.
;
grouprecord.ChildRecords)
(dr.NestingDepth == iDepth)
((dr.Tag.ToString() == sTag))
}
else
gr = GetGroupbyRecord(dr, iDepth, sTag);
)
gr;
Called it like on record expanding/collapsing event:
GroupByRecord gr = GetGroupbyRecord(dgPositionsGrid.Records[e.Record.UltimateParentRecord.Index], e.Record.NestingDepth, e.Record.Tag.ToString());
gr.IsExpanded =
true;
As for the depth, it makes sense now. But there should be something to figure out whats the record number.
Excellent Harshad. I was trying the exactly same approach but never made it work as I want to.
I used a custom class ParentHistory, which I put in the tag of every expanded record, which exposed a collection of its parents (nested depth and index). That I used in the RecordExpanded event of the main XamDataGrid. I am not sure why I never got it working correctly, probably a silly mistake. I would appreciate if you gave me the working code, so that I can update my sample and sleep normally.
I am not sure about this bug. The record's index is its position inside the group record, if that is what you have in mind. NestedDepth is how deep it is. For example, it should be like this:
I believe the structure should be this:
I managed to get it working. I had to loop through the records recursively to find the corresponding record in other grids. I used Nesteddepth and tag to figure that out.
I think there is a bug in infragistics. If you have a heirarchical grid with 3 levels, then what I found was the top level and second level group has record index of 0 while the third level has 1. why is it not 0,1,2 respectively?
Also you cannot get the dataitem on groupby record. which makes sense since its not a actual record.
Harshad,
You are correct. This will complicate the expansion logic. I am not sure if this is the best approach, but as you have nested group records, you need to keep track of which record expands and which are its ancestor records so that you will be able to find it in the other grids.
Another way would be to use the GetRecordFromDataitem(...) method. This way, you can use the DataItem(your underying object) to find the DataRecord in the other grids. This however, will still require custom logic to handle expading the GroupByRecords.
I have encountered a problem with this one when you have a heirarchical grid with grouping on 3 columns. When I expand on the the 2nd grouped record, e.Record.Index still gives me 0 and hence xamdatagrid2.Records[0] would give me the top level group. Hence it doesnot expand the 2nd group. Same goes for the 3rd group. The only one that works is expanding 1st group.
Harshad