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.
Unfortunately, activation email could not send to your email. Please try again.

Hide group caption cell but keep the summary cell

Thread ID:

Created:

Updated:

Platform:

Replies:

49473 Sep 19,2006 06:43 PM Sep 21,2006 06:50 PM Windows Forms 4
loading
Tags: GridControl
Aiqun Wu
Asked On September 19, 2006 06:43 PM

I am using GridGroupingControl with syncfusion 4.2 to display a single table with two grouped columns. I display aggregated data in summary cells of group caption row. I would like to have the group caption cell to behave like the other summary cells. With the way it is now, the group caption cell is not selectable. If I use the default implementation of search, there is no way to find group caption cell.

My question is, is there a way to hide group caption cell, or make it behave the same way as the rest of summary cells?

I have tried the following approach. I created a dummy column with 0 width as the first column. The dummy column is added to the VisibleColumns collection. The dummy column becomes the group caption cell. Since the width is 0, the first summary cell is effective displayed as the first column. This almost worked, except the first summary cell is not flushed to the left next to the plus/minus button.

Any advice would be greatly appreciated.

Thanks


Administrator [Syncfusion]
Replied On September 20, 2006 02:59 AM

Hi Aiqum,

Issue 1: change the appearance of the GroupCaption cell.

To change the appearance of the GroupCaption cell in a grid, you can set the CellType to Static and Enabled property to False.

this.grid.TableDescriptor.Appearance.GroupCaptionCell.CellType ="Static";
this.grid.TableDescriptor.Appearance.GroupCaptionCell.Enabled = false;

Issue 2:

There is a built-in support for hide the a single cell in a grid. If you want to hide the GroupCaption row in a grid, you need to set the ShowCaption property to false.

//For MainTable GroupCaption..
this.gridGroupingControl1.TopLevelGroupOptions.ShowCaption = false;

//For nested GroupCaption..
this.gridGroupingControl1.NestedTableGroupOptions.ShowCaption = false;

//For ChildGroupCaption.
this.gridGroupingControl1.ChildGroupOptions.ShowCaption = false;

Let me know if you are looking something different.

Best Regards,
Haneef

Aiqun Wu
Replied On September 20, 2006 10:35 AM

Haneef,

Thanks for the quick reply.

I did set GroupCaptionCell to a different cell type. The appearance is OK. My issue is that if I click on the group caption cell, there is no focus rectangle around the cell border like the other cells. If I search for a matching cell, I can never match the text in group caption cell (in default search implementation through GridFindReplaceDialog). Another issue with group caption cell is that the default search seems only be able to match within the group the active cell belongs.

I do not want to hide the group caption row because I want to be able expand/collapse groups. I also want to see summary cells on the caption row.

To summarize, I want the group caption cell to behave the same way (selection, search) as other summary cells in the same row.

Any other ideas?

Thanks

Administrator [Syncfusion]
Replied On September 21, 2006 05:17 AM

Hi Aiqum,

Issue 1: FocusRectanlge and selection.

To show the FocusRectangle for GroupCaption cell in a grid, You need to can set the the Enabled property of GroupCaptionCell to TRUE. Below is a code snippet.

if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell || e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell )
{
GridGroupingControl grid = sender as GridGroupingControl;

GridCaptionRow gcr = e.TableCellIdentity.DisplayElement as GridCaptionRow;
//get value of first group

if(gcr.ParentGroup !=null )
{
e.Style.CellType = "Static";
e.Style.Enabled = true;
e.Style.ReadOnly = true;
GridTableControl tc = grid.GetTableControl(e.TableCellIdentity.Table.TableDescriptor.Name);
if( e.TableCellIdentity.RowIndex != tc.CurrentCell.RowIndex)
e.Style.BackColor = Color.AliceBlue;
else
e.Style.BackColor = grid.TableOptions.SelectionBackColor;
}
}

Are you using the Cell based selection technique? If so, you can add the selected range in a GridTableModel in CurrentCellActivating event.

e.TableControl.Model.Selection.Add(GridRangeInfo.Row(cc.RowIndex));

Currently there is no support for this in the Record based selection technique. But you can color cell using the QueryCellInfo event. Please refer the attached sample for more detail.

Sample : http://www.syncfusion.com/Support/user/uploads/LastrecUpdateSummaryNavigate_fc07bfc6.zip

See the KB for selection Types : http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344

Issue 2: GridFindDialog.

There is no built-in support for searching the GroupCaption text in a grid. If you want to search the GroupCaption text in a grid, you can do this by creating the HashTable or Arraylist and add the all caption text to the list for searching text in the grid.

Thanks,
Haneef

Aiqun Wu
Replied On September 21, 2006 06:50 PM


Haneef,

The e.Style.Enabled property makes the group caption cell selectable. Also for a nice surprise, the search works for the group caption cell as well.

Thanks

Aiqun


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;