Merge rows in GDBG based on range merged in previous column
Hello.
I am working with a GridDataBoundGrid and I am wondering how to merge similar rows in a column in a "tiered" fashion, i.e. similar values in column 1 are merged, then similar values in column 2 are merged but ONLY if they are within the range of merged values in column 1, etc., etc.
A "before-and-after" example is attached, showing what I have displayed currently and what kind of display I want afterward.
Is there any functionality already in place that achieves this effect? Otherwise, what methods will help achieve this effect?
Thanks in advance.
MergeRowsInColumnByGroup_488a0369.rar
I am working with a GridDataBoundGrid and I am wondering how to merge similar rows in a column in a "tiered" fashion, i.e. similar values in column 1 are merged, then similar values in column 2 are merged but ONLY if they are within the range of merged values in column 1, etc., etc.
A "before-and-after" example is attached, showing what I have displayed currently and what kind of display I want afterward.
Is there any functionality already in place that achieves this effect? Otherwise, what methods will help achieve this effect?
Thanks in advance.
MergeRowsInColumnByGroup_488a0369.rar
SIGN IN To post a reply.
5 Replies
RC
Rajadurai C
Syncfusion Team
March 4, 2010 03:49 PM UTC
Hi Andrew,
Thanks for your interest in Syncfusion Products.
In GridDataBoundGrid, to achieve the layout mentioned in the excel sheet attached, you can make use of the CoveredRanges method for merging the cells.
To retain the covered range based on the changes handled at runtime, QueryCoveredRange event can be handled. Here is a sample for your reference in which similar kind of layout has been achieved in GridGroupingControl.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=F91705-240140371.zip
Regards,
Rajadurai
Thanks for your interest in Syncfusion Products.
In GridDataBoundGrid, to achieve the layout mentioned in the excel sheet attached, you can make use of the CoveredRanges method for merging the cells.
To retain the covered range based on the changes handled at runtime, QueryCoveredRange event can be handled. Here is a sample for your reference in which similar kind of layout has been achieved in GridGroupingControl.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=F91705-240140371.zip
Regards,
Rajadurai
AL
Andrew Lien
March 4, 2010 06:58 PM UTC
Thank you for the quick response.
Now that I know to use CoveredRanges method to get the range of cells covered, I can use this GridRangeInfo object.
What I would like to know now is if there is a way to merge similar rows in a column only for a limited range of rows, such as the height of the GridRangeInfo object that is returned by the CoveredRanges method?
Thanks.
Now that I know to use CoveredRanges method to get the range of cells covered, I can use this GridRangeInfo object.
What I would like to know now is if there is a way to merge similar rows in a column only for a limited range of rows, such as the height of the GridRangeInfo object that is returned by the CoveredRanges method?
Thanks.
RC
Rajadurai C
Syncfusion Team
March 5, 2010 05:38 PM UTC
Hi Andrew,
Thanks for your update.
To deal with merging of cells in a single column or a single row, the MergeCell property of the respective one too, has to be set. Please try the following code.
Regards,
Rajadurai
Thanks for your update.
To deal with merging of cells in a single column or a single row, the MergeCell property of the respective one too, has to be set. Please try the following code.
this.gridDataBoundGrid1.Model.Options.MergeCellsMode = GridMergeCellsMode.SkipHiddencells | GridMergeCellsMode.OnDemandCalculation | GridMergeCellsMode.MergeRowsInColumn;
this.gridDataBoundGrid1.Model.ColStyles[2].MergeCell = GridMergeCellDirection.RowsInColumn;
this.gridDataBoundGrid1.Model.RowStyles[2].MergeCell = GridMergeCellDirection.ColumnsInRow;
Regards,
Rajadurai
AL
Andrew Lien
March 19, 2010 05:03 PM UTC
Hello,
I don't think I was clear enough before.
I think what I am trying to get at is if it is possible to merge cells for only a portion of a column, instead of having the cells automatically merge for the entire column. The same goes for rows.
The code you provided seems to only do automatic merges.
I looked at my example again, and I noticed that these automatic merges would do the same, except in the bottom right portion with all of the "3" values. In automatic merging, all of these values would merge together; however, in my implementation they will not because they are each part of a separate "group". This is shown by the previous column values "1, 2, 3".
To summarize, since each "3" value belongs to the value in the previous column, they will only merge "within" the range of the previous column. Another way to think about it would be a child-parent relationship, where any given column is a parent of the next column, as well as a child of the previous column.
I hope this clears up what I am trying to do.
Thank you.
I don't think I was clear enough before.
I think what I am trying to get at is if it is possible to merge cells for only a portion of a column, instead of having the cells automatically merge for the entire column. The same goes for rows.
The code you provided seems to only do automatic merges.
I looked at my example again, and I noticed that these automatic merges would do the same, except in the bottom right portion with all of the "3" values. In automatic merging, all of these values would merge together; however, in my implementation they will not because they are each part of a separate "group". This is shown by the previous column values "1, 2, 3".
To summarize, since each "3" value belongs to the value in the previous column, they will only merge "within" the range of the previous column. Another way to think about it would be a child-parent relationship, where any given column is a parent of the next column, as well as a child of the previous column.
I hope this clears up what I am trying to do.
Thank you.
RC
Rajadurai C
Syncfusion Team
March 29, 2010 12:38 PM UTC
Hi Andrew,
I regret for the delay caused in getting back to you.
Merge functionality in Syncfusion Grid follows the standard behavior, in which customization as mentioned(restricting merging to only certain rows) when applied, will affect its generic behavior.
Hence, in such cases, it is preferable to make use of CoveredRanges method and based on the condition at runtime, handle the same in QueryCoveredRange event.
Regards,
Rajadurai
I regret for the delay caused in getting back to you.
Merge functionality in Syncfusion Grid follows the standard behavior, in which customization as mentioned(restricting merging to only certain rows) when applied, will affect its generic behavior.
Hence, in such cases, it is preferable to make use of CoveredRanges method and based on the condition at runtime, handle the same in QueryCoveredRange event.
Regards,
Rajadurai
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
AL Andrew Lien
- Mar 2, 2010 06:27 PM UTC
- Mar 29, 2010 12:38 PM UTC