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.

Highlighting rows

Thread ID:

Created:

Updated:

Platform:

Replies:

23737 Jan 18,2005 01:35 PM Jan 30,2005 07:05 AM Windows Forms 13
loading
Tags: Grouping
Anthony Avella
Asked On January 18, 2005 01:35 PM

I''m currently using version 3... of the grid. Is there a way to highlight a group of summary rows? If there is a way to do this, is it possible to know programatically the rows that are highlighted, and the actual values inthe highlighted cells?

Administrator [Syncfusion]
Replied On January 18, 2005 01:45 PM

Hi Anthony, selecting summary rows is not supported with the new record-based selection mechanism. If you use the old mechanism (when you set TableOptions.AllowSelection = GridSelectionFlags.Any) then you can select any cell, but the old mechanism does not work well with collapse/expand functionality. In order to loop through selected cells in old selection mechanism you can loop through TableModel.Selections.Ranges Stefan

Anthony Avella
Replied On January 19, 2005 08:55 AM

By commenting out the following line of code - grid.TableOptions.ListBoxSelectionMode = SelectionMode.One;, I''m able to make selections in my grid. The problem I''m now encountering is when I right click in the selected area to bring up a pop-up menu to allow operations to be performed on the selected rows. When I right-click, the highlight disappears and the selected range seems gone. How can I keep my selected range while I right click within the selected range? >Hi Anthony, > >selecting summary rows is not supported with the new record-based selection mechanism. > >If you use the old mechanism (when you set TableOptions.AllowSelection = GridSelectionFlags.Any) then you can select any cell, but the old mechanism does not work well with collapse/expand functionality. > >In order to loop through selected cells in old selection mechanism you can loop through TableModel.Selections.Ranges > >Stefan >

Administrator [Syncfusion]
Replied On January 19, 2005 10:04 AM

Try setting: grid.TableModel.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;

Anthony Avella
Replied On January 20, 2005 09:38 AM

Thanks. I am now at the point where I can highlight a group of rows, both summary and detail rows. It appears that the selection refers to a section of the grid more than the data in the selected area. When I highlight a group of summary rows, then expand those rows to view the detail rows, the area of highlight does not increase - instead the detail rows take up at least a portion of the highlight and the remaining summary rows are not highlighted. When I highlight a range of unexpanded summary rows, is there a way I can access the values in those highlighted summary cells in my code? When a range is highlighted, I need the actual value (not the column name) the detail rows are grouped by. Thanks. >Try setting: > >grid.TableModel.Options.SelectCellsMouseButtonsMask = MouseButtons.Left; >

Administrator [Syncfusion]
Replied On January 21, 2005 07:16 AM

Anthony, the cell-based selection mechanism has no knowledge about groups, only the underlying cells. It is a pure Grid-based solution. That''s why collapsing and expanding cells is not correctly handled. In order to acess values for a selected range, you can get the GridRangeInfo and then check the contents of the cells. GridRangeInfo range = grid.TableModel.Seclections.Ranges.ActiveRange; if (!range.IsEmpty) { for (int r = range.Top; r < range.Bottom; r++) { Element el = grid.Table.DisplayElements[r]; if (el is SummaryRow) { Group parentGroup = el.ParentGroup; // now here you can get values from SummaryRow } } } Stefan

Anthony Avella
Replied On January 25, 2005 01:29 PM

How do I get the values that are in the summary cells? >Anthony, > >the cell-based selection mechanism has no knowledge about groups, only the underlying cells. It is a pure Grid-based solution. That''s why collapsing and expanding cells is not correctly handled. > >In order to acess values for a selected range, you can get the GridRangeInfo and then check the contents of the cells. > > >GridRangeInfo range = grid.TableModel.Seclections.Ranges.ActiveRange; >if (!range.IsEmpty) >{ >for (int r = range.Top; r < range.Bottom; r++) >{ >Element el = grid.Table.DisplayElements[r]; >if (el is SummaryRow) >{ >Group parentGroup = el.ParentGroup; >// now here you can get values from SummaryRow > >} >} >} > >Stefan > > >

Administrator [Syncfusion]
Replied On January 25, 2005 02:06 PM

Anthony, You could loop through all cells in the row: int r; // the row for (int c = 1; c <= grid.TableModel.ColCount; c++) { GridTableCellStyleInfo style = (GridTableCellStyleInfo) grid.TableModel[r, c]; if (style.TableCellIdentity.SummaryColumn != null) Console.WriteLine(style.TableCellIdentity.SummaryColumn.Name + ": " + style.FormattedText); } Stefan

Anthony Avella
Replied On January 26, 2005 11:50 AM

2 questions: 1- How do I know the summary row I''m in (int r; // the row)? 2- Can I convert the column index in your loop to a column name to be able to identify/retrieve the value of a certain column in the row? Thanks. >Anthony, > >You could loop through all cells in the row: > >int r; // the row >for (int c = 1; c <= grid.TableModel.ColCount; c++) >{ >GridTableCellStyleInfo style = (GridTableCellStyleInfo) grid.TableModel[r, c]; >if (style.TableCellIdentity.SummaryColumn != null) > Console.WriteLine(style.TableCellIdentity.SummaryColumn.Name + ": " + style.FormattedText); >} > >Stefan >

Administrator [Syncfusion]
Replied On January 26, 2005 01:18 PM

Anthony, You can get the summary row from r with GridSummaryRow sumarryRow = grid.Table.DisplayElements[r] as GridSummaryRow; style.TableCellIdentity.SummaryColumn.Name will give you the name of the summary column. int r; // r is here the r-value from the for (int r = range.Top; r <= range.Bottom; r++) loop mentioned earlier. Stefan

Anthony Avella
Replied On January 27, 2005 07:11 AM

The Summary Row is comprised of the group by value and 0 or more summary column descriptors. How do I get the value of the group by column? >Anthony, > >You can get the summary row from r with > >GridSummaryRow sumarryRow = grid.Table.DisplayElements[r] as GridSummaryRow; > >style.TableCellIdentity.SummaryColumn.Name will give you the name of the summary column. > >int r; // r is here the r-value from the for (int r = range.Top; r <= range.Bottom; r++) loop mentioned earlier. > >Stefan

Administrator [Syncfusion]
Replied On January 27, 2005 12:30 PM

Try grid.Table.DisplayElements[r].ParentGroup.Category whereas r is the rowindex of the summaryRow. Stefan

Anthony Avella
Replied On January 27, 2005 01:50 PM

Great. Thanks. I have a somewhat related question now.... Let''s suppose my grouped grid is only showing part of a dataset (some columns have been filtered out via a dataview). I''d like to iterate through those rows in my code to retrieve the same value as I am in this discussion. Will the this foreach loop - foreach(Record r in grid.Table.Records) do that for me or will this go through the whole underlying dataset? If this does go through the whole dataset, how can I just iterate through all of the visible rows in the grid? I''d like to iterate through all of the VISIBLE summary rows in the grid and get the category as you just showed me. thx. >Try > >grid.Table.DisplayElements[r].ParentGroup.Category > >whereas r is the rowindex of the summaryRow. > >Stefan > >

Administrator [Syncfusion]
Replied On January 30, 2005 07:05 AM

If you want to get the filtered records, try using this.gridGroupingControl1.Table.FilteredRecords instead of this.gridGroupingControl1.Table.Records.

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.

;