AD
Administrator
Syncfusion Team
July 22, 2004 02:03 PM UTC
Daniel,
The GridTableRowHeaderCellRenderer (RowHeaderCell celltype) ignores this setting since it does not make sense to display the underlying row index in most cases. Row 1 will be the column headers and records would be offset.
What is better is if you display the record index instead. You can do this by handling the TableControlPrepareViewStyleInfo event and specify "Header" as cell type.
this.groupingGrid1.TableControlPrepareViewStyleInfo += new GridTableControlPrepareViewStyleInfoEventHandler(groupingGrid1_TableControlPrepareViewStyleInfo);
private void groupingGrid1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.Inner.Style;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordRowHeaderCell
|| style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordRowHeaderCell)
{
Record r = style.TableCellIdentity.DisplayElement.ParentRecord;
int recordIndex = r.ParentTable.Records.IndexOf(r);
string displayText = recordIndex.ToString();
e.Inner.Style.CellValue = displayText;
e.Inner.Style.CellType = "Header";
}
}
Stefan
DC
Daniel Chait
July 22, 2004 02:14 PM UTC
Thanks... what''s the difference between
groupingGrid1.TableControlPrepareViewStyleInfo
and
gridGroupingControl1.QueryCellStyleInfo
They seem like they accomplish similar things, no? If I already have code in QueryCellStyleInfo will it clobber the other?
>Daniel,
>
>The GridTableRowHeaderCellRenderer (RowHeaderCell celltype) ignores this setting since it does not make sense to display the underlying row index in most cases. Row 1 will be the column headers and records would be offset.
>
>What is better is if you display the record index instead. You can do this by handling the TableControlPrepareViewStyleInfo event and specify "Header" as cell type.
>
>
>this.groupingGrid1.TableControlPrepareViewStyleInfo += new GridTableControlPrepareViewStyleInfoEventHandler(groupingGrid1_TableControlPrepareViewStyleInfo);
>
>private void groupingGrid1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
>{
> GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.Inner.Style;
> if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordRowHeaderCell
> || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordRowHeaderCell)
> {
> Record r = style.TableCellIdentity.DisplayElement.ParentRecord;
> int recordIndex = r.ParentTable.Records.IndexOf(r);
>
> string displayText = recordIndex.ToString();
>
> e.Inner.Style.CellValue = displayText;
> e.Inner.Style.CellType = "Header";
> }
>}
>
>
>
>Stefan
>