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
close icon

Required a custom grouping header and row cells (See Snap shot)

Hi,

I require very special header and row cells which would be generated dynamically from DB and I am not sure if it is good to use GGC 5.4.x.x!

Can you please tell me if I need to use the customengine.cs and How can I amend if needed.

Thanks in advance.

Nhilesh Baua.


screen_shot1.zip

4 Replies

HA haneefm Syncfusion Team July 3, 2007 08:04 PM UTC

Hi Nhilesh,

One way you can do this by hanlding the QueryCoveredRange event and set the covered rage for grouped rowheader cell and it corresponding grouped filed value. Below are the code snippet that show this task.

void TableModel_QueryCoveredRange(object sender, GridQueryCoveredRangeEventArgs e)
{
GridTableModel tableModel = sender as GridTableModel;

Element el = tableModel.GetDisplayElementAt(e.RowIndex);
if (el != null)
{
int count = el.ParentGroup.Records.Count - 1;
if (count > 0)
{
GridTableCellStyleInfo style = tableModel.Table.GetTableCellStyle(e.RowIndex, e.ColIndex);
if (e.ColIndex == 0)
{
e.Range = GridRangeInfo.Cells(e.RowIndex, e.ColIndex, e.RowIndex + count, e.ColIndex);
e.Handled = true;
}
else if (style.TableCellIdentity.Column != null
&& style.TableCellIdentity.Column.Name == "Rank")
{
e.Range = GridRangeInfo.Cells(e.RowIndex, e.ColIndex, e.RowIndex + count, e.ColIndex);
e.Handled = true;
}
}
}
}

Also refer the below sample for implementation and let me know if this helps.
GGC_NestedChilds.zip

Best regards,
Haneef


NB Nhilesh Baua July 4, 2007 07:06 AM UTC

Hi Haneef,

Thanks for the code, that's something very near to the requirement, however 2 things I have noted with the same...

1. There is an extra blank row with header "Group" before all other groups.
2. If I mouse over on any of row headers and if mouse cursor is on the last row region of the group, it overlaps to the next group header.

and I get following error for
GridTableModel tableModel = sender as GridTableModel;

"Object reference not set to an instance of an object"

so couldn't test it further.

anyways thanks for the help so far.
Please let me know on the above things.

Thanks & Regards,
Nhilesh Baua


HA haneefm Syncfusion Team July 4, 2007 05:49 PM UTC

Hi Nhilesh,

1. There is an extra blank row with header "Group" before all other groups.
>>>>>>>>>>>>>
You can hide the AddNewRecord by setting the TopLevelGroupOptions.ShowAddNewRecordBeforeDetails property to false. Below is a code snippet

this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;

2)If I mouse over on any of row headers and if mouse cursor is on the last row region of the group, it overlaps to the next group header.
>>>>>>>>

You can call the Refresh method to re-paint the columnheader on mousemove. Below are the code snippet

this.gridGroupingControl1.TableControl.MouseMove += new MouseEventHandler(TableControl_MouseMove);

void TableControl_MouseMove(object sender, MouseEventArgs e)
{
GridTableControl tc = sender as GridTableControl;
tc.Refresh();// Range(GridRangeInfo.Cols(1, 2));
}


Best regards,
Haneef


NB Nhilesh Baua July 6, 2007 06:06 AM UTC

Hi Haneef,

Thanks for your efforts, I tried your way, However it did't got my work done. Anyways I figured out somthing else.

Still you are rocking , cheers :).

Regards,
Nhilesh Baua

Loader.
Live Chat Icon For mobile
Up arrow icon