We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridGroupingControl - Merging Cells

Hi,

We are working with GGC v 3.2.1.0.

I want to merge a column in all rows. Say if a column A has string data d1, d2, d3 in rows r1, r2 and r3. I want to merge all A column cells and display concatenated data as "d1. d2. d3".

I am trying using MergeCellsMode = GridMergeCellsMode.OnDemandCalculation|GridMergeCellsMode.MergeRowsInColumn; AND Column A.MergeCell = GridMergeCellDirection.RowsInColumn;

But I couldn''t get it.

Otherwise, is it possible to merge all columns (column Name A), but display data of first column alone? Assumung that I get data "d1. d2. d3" in first row only.

Thanks and Regards
Rajani Kanth

6 Replies

AD Administrator Syncfusion Team September 5, 2006 08:44 AM UTC

Hi Rajani,

The grid actually has two ways to make a group of cells display as one large cell. The first technique is coverd cells where an explicit group of cells can be made to

behave like a single cell. The second technique is merged cells where adjacent cells that hold duplicate values as group together so you only see the value once.

By merging cells, do you mean making a range of cells appear as a single cell. If so, you use the QueryCoveredRange event in the Grid to do this.

private void gridGroupingControl1_QueryCoveredRange(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableQueryCoveredRangeEventArgs e)
{
if (e.RowIndex < e.Table.DisplayElements.Count)
{
Element el = e.Table.DisplayElements[e.RowIndex];
if(el.Kind == DisplayElementKind.Record)
{
if(e.ColIndex == 1 )
{
int start = e.Table.Elements.IndexOf( e.Table.Records[0] );
e.Range = GridRangeInfo.Cells(start, e.ColIndex, start+ e.Table.Records.Count - 1,e.ColIndex);
e.Handled = true;
}
}
}
}

If you want to make adjacent cells that have the same values in them only show the value once, then you need to set one grid property, and then set a style property in the

cells that you want to allow to merge.

//Merge Cell based on the cell content.
this.gridGroupingControl1.TableModel.Options.MergeCellsMode = GridMergeCellsMode.OnDemandCalculation|GridMergeCellsMode.MergeRowsInColumn;
this.gridGroupingControl1.TableDescriptor.Columns["A"].Appearance.AnyRecordFieldCell.MergeCell = GridMergeCellDirection.RowsInColumn;

Here is a sample project showing how this is done.
http://www.syncfusion.com/Support/user/uploads/GGC_MergeColumn_16d12ff9.zip

Let us know if you need more information on this.

Regards,
Haneef


BR Badri Rajani Kanth September 5, 2006 09:28 AM UTC

Hi Haneef,

I tried with merging earlier.

this.gridGroupingControl1.TableModel.Options.MergeCellsMode = GridMergeCellsMode.OnDemandCalculation|GridMergeCellsMode.MergeRowsInColumn;
this.gridGroupingControl1.TableDescriptor.Columns["A"].Appearance.AnyRecordFieldCell.MergeCell = GridMergeCellDirection.RowsInColumn;

This code is not merging even in your sample .I made dr[0] = "data"; and commented QueryCoveredRange and QueryCellStyleInfo events.

But duplicate data is not merged. Can you please tell me if there is any other property also?

Rgds
Rajani Kanth


BR Badri Rajani Kanth September 6, 2006 08:19 AM UTC

Hi Haneef,

Any Input on this plz..

Rgds
Rajani Kanth


AD Administrator Syncfusion Team September 6, 2006 09:46 AM UTC

Hi Rajani,

We regret for the inconvenience caused.

I am able to see this issue in version 3.2 and it is now fixed in our latest release version 4.2 (v4.2.0.37). Here is the download link:

http://www.syncfusion.com/Downloads/latestversion.aspx


Please install this version and let me know if you see any problems.

Thanks for using Syncfusion products.

Best Regards,
Haneef


BR Badri Rajani Kanth September 6, 2006 10:50 AM UTC

Thank You Haneef,

But we and our client are using V 3.2.1.0 only. So, i have to check if we can upgrade to latest version.

Earlier also we had an issue like this, where we updated our application with fixed DLL. Plz see..
https://www.syncfusion.com/Support/DirectTrac/user/details.aspx?id=24209

Now also, is it possible for you to give the fixed dll of v.3.201.1.1. This dll should be compiled with all other dependent references point to v.3.201.1.0.

Rgds
Rajani Kanth


AD Administrator Syncfusion Team September 7, 2006 11:07 AM UTC

Hi Rajani,

Thanks for being patience.

Please open a D-Trac incident to have further details and for the answer on this issue. For more details on opening a new D-Trac incident, please contact our sales team ( sales@syncfusion.com ).

Thanks,
Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon