AD
Administrator
Syncfusion Team
November 8, 2005 05:11 PM UTC
Hi,
I know my question is very basic but i need help.
Could someone please elp me? or at least provide some pointer here.
thanks,
KishoreJ
ST
stanleyj
Syncfusion Team
November 9, 2005 06:58 AM UTC
Hi Kishore,
Take a look at the GridGroupingContol which is flexible in managing hierarchical data and where the summary row is built in. Please refer to the samples that we ship syncfusion\essential studio\3.3.0.0\Windows\Grid.Windows\samples\Grouping\CustomSummary and syncfusion\essential studio\3.3.0.0\Windows\Grid.Windows\samples\Grouping\HierarchySample.
To get a summary row in a GDBG there is a lot of work to be done with it.
Here is a sample that shows the total rows at the end of the GDBG. The summary row is a single row of the grid control which is located at the bottom of the GDBG. The GC is synchronized with the GDBG (see GridSummaryRow.cs). In the support class through the SaveCellInfo and CellButtonClicked events, the updates are made in the summary row.
To hide any row, you will have to pass the RowIndex which, is a bit tricky as the child row gets displayed in varied row indexes.
Please refer these samples, decide the control and let me know if you have any more questions.
Best regards,
Stanley
AD
Administrator
Syncfusion Team
November 9, 2005 05:28 PM UTC
Thanks Stanley,
Q#1
Can i bind a datasource (data table) to a Grouping Control?
Q#2
How can i update my last row and parent row when i update child row?
Please do reply!
Thanks,
AD
Administrator
Syncfusion Team
November 9, 2005 05:32 PM UTC
Stanley,
I am more interested in using GDBG control.
Would it be easy to hide a child row and display summary/total row at the end if i use formulas?
IF yes, would it be possible to provide a sample?
ST
stanleyj
Syncfusion Team
November 10, 2005 09:44 AM UTC
Hi Kishore,
>>Would it be easy to hide a child row and display summary/total row at the end if i use formulas?
This is quite a simple try, see if this
sample serves your purpose. I have placed the summary creating an extra row header of the GDBG.
The reply to your previous post is below.
1) The GridGroupingControl is a data bound grid and it is bindable. It has the DataSource property.
2) Can you please describe in detail, what you are looking for?
Best regards,
Stanley
AD
Administrator
Syncfusion Team
November 10, 2005 05:34 PM UTC
Thanks Stanley,
This is pretty much close to what I am looking for.
I need to hide child row(s) and update corresponding parent row. I will try to explain with example.
-parent1 Sum(Child1s) Sum(Child1s) Flag
child11 childX11 childY111
child11 childX11 childY112 Y
-parent2 Sum(Child2s) Sum(Child2s)
child21 childX21 childY21
child22 childX22 childY22 Y
-parent3 Sum(ChildX3s) Sum(Child3s)
child31 childX31 childY31
child32 childX32 childY32 Y
Once I checked my checkbox, I need to hide all the child which has ‘Y’ in flag column. Once I hide the columns I need to display correct values in parent columns.
I know, I am not the only one who is looking for help, but If you could help me.
Please do help!
Regards,
AD
Administrator
Syncfusion Team
November 10, 2005 09:00 PM UTC
I think it would be much easier to do this with a GridGroupingControl. Here is a lttle sample.
http://www.syncfusion.com/Support/user/uploads/GGC_Summaries_73d455a9.zip
AD
Administrator
Syncfusion Team
November 11, 2005 08:15 AM UTC
clay,
i am not able to build the sample provided by you. i am getting the following mesasge.
(152): ''Syncfusion.Windows.Forms.Grid.Grouping.GridEngine'' does not contain a definition for ''GetSummaryText''
Please also help with the following questions.
#1
do i have control at coloumn level in grouping control, and how?
#2
which event is good for if i need to change the style of a column, something like prepareviewstyle?
#3
how can i hide few columns in grouping control?
please do help!
KishoreJ
AD
Administrator
Syncfusion Team
November 11, 2005 08:31 AM UTC
The GetSummaryText method was added within the last couple of releases. Are you not using the 3.3 release? If you are staring a new project it would be a good time to move up to a later version.
You can do all three of the things you listed.
1) grid.TableDescriptor.Columns["colName"].Appearance.AnyCell is the GridStyleInfo for the column whose name is "colName".
2)There is a TableControlPrepareViewStyleInfo event.
3) There is a grid.TableDescriptor.VisibleColumns collection.
AD
Administrator
Syncfusion Team
November 11, 2005 04:45 PM UTC
Thanks clay,
Yes, this is my first project with syncfusion grid but is is being used by my company since last 18 months. At this point there is no plan for upgrade.
what is the purpose of ''GetSummaryText'' method? could yuo please suggest the workaround for this method?
Thanks & waiting for reply!
thanks,
KishoreJ
AD
Administrator
Syncfusion Team
November 11, 2005 04:57 PM UTC
It will take some coding on your part to replace the GetSummaryText method. The purpose of this method is to look up a summary value. In this case, we are looking up the summary value from the child to display in the unbound cell in the parent record.
Here is forum thread that has a sample that retrieves some summary values. http://www.syncfusion.com/Support/forums/message.aspx?MessageID=29719
AD
Administrator
Syncfusion Team
November 11, 2005 10:51 PM UTC
Hi,
i am trying to add a summary row to my GDBG using the following code
//2) or set each column style ....
GridStyleInfo[] styles = new GridStyleInfo[this.grid.Model.ColCount];
for(int i = 0; i < this.grid.Model.ColCount; ++i)
{
styles[i] = new GridStyleInfo((GridStyleInfoStore)this.grid.Binder.InternalColumns[i].StyleInfo.Store.Clone());
if (i==1)
{
styles[i].Text=" Total";
}
styles[i].Font.Bold = true;
styles[i].BackColor = Color.LightYellow;
}
sumRow.WireSummaryRow(this.grid, summaryTypes, styles);
My for loop is too-too slow, and finally i am getting soem error.
do you see any thing wrong?
Please do help?
AD
Administrator
Syncfusion Team
November 11, 2005 11:16 PM UTC
>Hi Kishore,
>
> Take a look at the GridGroupingContol which is flexible in managing hierarchical data and where the summary row is built in. Please refer to the samples that we ship syncfusion\essential studio\3.3.0.0\Windows\Grid.Windows\samples\Grouping\CustomSummary and syncfusion\essential studio\3.3.0.0\Windows\Grid.Windows\samples\Grouping\HierarchySample.
>
> To get a summary row in a GDBG there is a lot of work to be done with it.
Here is a sample that shows the total rows at the end of the GDBG. The summary row is a single row of the grid control which is located at the bottom of the GDBG. The GC is synchronized with the GDBG (see GridSummaryRow.cs). In the support class through the SaveCellInfo and CellButtonClicked events, the updates are made in the summary row.
> To hide any row, you will have to pass the RowIndex which, is a bit tricky as the child row gets displayed in varied row indexes.
>
>Please refer these samples, decide the control and let me know if you have any more questions.
>
>Best regards,
>Stanley
Stanley,
could you please modify that sample to use "sumRow.WireSummaryRow(this.grid, summaryTypes, styles);
" method to write the grid?
I am having problem to pupulate styles since my grid has parent-child concept.
having problem because these tow values are not same
this.grid.Model.ColCount
AND
this.grid.Binder.InternalColumns[]
Please do help!
AD
Administrator
Syncfusion Team
November 12, 2005 01:18 AM UTC
That sample you are referring to that uses the WireSummaryRow method was designed to be used with flat GridDataBoundGrids, not hierarchical GridDataBoundGrids. There will not be an easy way to do this with a GridDataBoundGrid. You will have to write a lot of code. The only way I would know to do this is to add unbound columns to your parent table to hold the summary values you want from the child table. Then you would have to maintain all these summaries for each child table, and then use grid.Model.QueryCellInfo to provide these summaryvalues. You can use an event like CurrentCellAcceptedChanges to update changes by your users. Here is a minimal sample.
http://www.syncfusion.com/Support/user/uploads/GDBG_CoveredCells_48eaec66.zip
If you want to do summaries for a hierarchical datasource, it woul dbe much easier to handle this requirement using a 3.3 GridGroupingControl.
AD
Administrator
Syncfusion Team
November 12, 2005 07:44 AM UTC
Clay,
I really appreciate your help. In my case i just relaized that almost none of the edits/actions on my grid will actually change the values in summary row.
So if there is change that will impact the values in summary rows that i can refresh from datatable/database.
is there a easy way to attach a simeple way to simply attach a row at the botom of GDBG as summary row? something like WireSummaryRow... or some easy way.
Please do reply!
thanks,
AD
Administrator
Syncfusion Team
November 12, 2005 09:29 AM UTC
>>is there a easy way to attach a simeple way to simply attach a row at the botom of GDBG as summary row? something like WireSummaryRow... or some easy way.
Not at the bottom of every child table. The only way I know to do it is to make the summary part of the parent record. The reason is that in the sample you meantioned, the summary row is actually a second grid. You can put a second grid under a single grid (as in the flat datasource case). But there is no simple way to insert mutiple summaryrow grids that would be needed for the hierarchical case, one per child table.
If you want summaries under every child table, then the easiest way to do it is to use a GridGroupingControl.