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.
Syncfusion Feedback

How to Display Group header and summary for filtered rows..

Thread ID:

Created:

Updated:

Platform:

Replies:

39832 Jan 19,2006 08:54 AM UTC Apr 4,2006 02:05 PM UTC Windows Forms 24
loading
Tags: GridControl
Prathima Venkobachar
Asked On January 19, 2006 08:54 AM UTC

hi, I have the following requirement. I am using gridGroupingControl. I am doing the grouping on state column. There is a link label , which allows the user to hide or show the rows that has negative ID. If in a group I have only negative rows and I have selected to show only positive ID, then that grouping will be visible on the grid. Is there is a way to show the groupheader and summary values of those groups even when those rows related to the groups are filtered out. I herewith attach a sample solution for my scenario. On load it displays all the groups for all the records. When I click on show All link, I still want to display all the groups but no record in the 1st group(which contains negative values).is it possible to achive..? Here I want to show the Group header and its summary value, when it is hidden but the rows should not be visible-is even more fine if we can remove from the grid and still able to show summary and grouping in the grid. Regards, Prathima

CS4.zip

stanleyj [Syncfusion]
Replied On January 19, 2006 01:40 PM UTC

Hi Parthima, Will this work for you? this.grid.Table.ExpandAllGroups(); // to show all this.grid.Table.TopLevelGroup.Groups[0].IsExpanded = false; // to collapse the first group. Regards, Stanley

Prathima Venkobachar
Replied On January 20, 2006 10:29 AM UTC

Hi, But its not working. I need to hide the rows for the particular groups. So those Grouping details should be shown and records should be filtered. Regards, Prathima.

stanleyj [Syncfusion]
Replied On January 20, 2006 12:26 PM UTC

Hi Prathima, I tried this way. If this is not fine for you, how is this expected? private void lblShow_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { if (this.lblShow.Text == "Show All") { showAll = false; this.grid.Table.ExpandAllGroups(); this.lblShow.Text = "Hide Negative"; } else { this.lblShow.Text = "Show All"; showAll = true; this.grid.Table.TopLevelGroup.Groups[0].IsExpanded = false; } } Best regards, Stanley

Prathima Venkobachar
Replied On January 23, 2006 05:25 AM UTC

Hi, My requirement is like while populating the grid, some of the groups should not display its records, but should display the grouping header and summary. So when clicking on "Expand button" of these groups, it should not show the records. Regards, Prathima

stanleyj [Syncfusion]
Replied On January 23, 2006 11:44 AM UTC

Hi Prathima, Refer ResizableRows sample of Grid.Grouping samples that we ship, that has a custom engine to save row heights. With this possibility, the row heights can be set to zero. You can loop through the records that has negative ID. private void lblShow_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { ArrayList list = new ArrayList(); if (this.lblShow.Text == "Show All") { showAll = false; ((IGridRowHeight)this.grid.Table.Records[0].RecordRows[0]).RowHeight = 17; ((IGridRowHeight)this.grid.Table.Records[1].RecordRows[0]).RowHeight = 17; ((IGridRowHeight)this.grid.Table.Records[2].RecordRows[0]).RowHeight = 17; this.grid.Refresh(); this.lblShow.Text = "Hide Negative"; } else { this.lblShow.Text = "Show All"; showAll = true; ((IGridRowHeight)this.grid.Table.Records[0].RecordRows[0]).RowHeight = 0; ((IGridRowHeight)this.grid.Table.Records[1].RecordRows[0]).RowHeight = 0; ((IGridRowHeight)this.grid.Table.Records[2].RecordRows[0]).RowHeight = 0; this.grid.Refresh(); } } Regards, Stanley

Prathima Venkobachar
Replied On January 31, 2006 09:44 AM UTC

Hi, Thanks It looks good, but I need to remove the (+/-) caption from the inner most Group header. When I group the records first by Country then by Zip Code, there should not be (+/-) sign on the ZIPCODE group header. At the same time it should present on the Country group Header. Regards, Prathima.

stanleyj [Syncfusion]
Replied On January 31, 2006 11:06 AM UTC

Hi Parathima, Check this thread, at the bottom there are code snippets to hide +/- buttons. see if that helps, if not can you be more specific of your tables in the grid. Best regards, Stanley

Prathima Venkobachar
Replied On February 2, 2006 04:34 AM UTC

Hi Stanley, I tried this but it clearing the indention for all rows. I need the indention for all groups, but just need to hide the (+/-) symbol from the last group header. Can I hide this one using the property TableOptions.ShowRecordPlusMinus Regards, Prathima

stanleyj [Syncfusion]
Replied On February 2, 2006 05:37 AM UTC

Hi Parthima, Please refer this one. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=38251 Best regards, Stanley

Prathima Venkobachar
Replied On February 2, 2006 08:59 AM UTC

Hi Stanley, In this sample application, it used nested tables, but me its not a nested table. I need to hide (+/-) for the first group only.

CS8.zip

stanleyj [Syncfusion]
Replied On February 2, 2006 01:17 PM UTC

Hi Prathima, You will have to play around with GroupCaptionPlusMinusCell, this will apply to all the +/- buttons. If only the first group +/- is to be hidden, more coding has to be done. I will update you as soon as possible. private void grid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell) { e.Style.CellType = "Static"; e.Style.Borders.Bottom = new GridBorder(this.grid.TableModel.Options.DefaultGridBorderStyle, SystemColors.GrayText); } } Best regards, Stanley

stanleyj [Syncfusion]
Replied On February 6, 2006 12:03 PM UTC

Hi Prathima, Let me know if this helps. private void grid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell) { Element el=this.grid.Table.DisplayElements[e.TableCellIdentity.RowIndex]; GridCaptionRow gcr=(GridCaptionRow)el; if(gcr!=null) { Group g=gcr.ParentGroup; int index=g.ParentGroup.Groups.IndexOf(g); if(index==0) { e.Style.CellType = "Static"; } } } } Best regards, Stanley

Prathima Venkobachar
Replied On February 7, 2006 11:34 AM UTC

Thanks Stanley, it works fine Regards, Prathima.

Prathima Venkobachar
Replied On March 17, 2006 02:05 PM UTC

Hi Stanley, When reducing the row height to zero for some records, its affecting performance. Is there any alternative to get the summary values of filtered rows? Or can i make use of any properties for getting the summary of hidden rows?

Administrator [Syncfusion]
Replied On March 21, 2006 02:01 PM UTC

Hi Prathima, Sorry for the delayed response. Attached is a sample which filters the record using the TableDescriptor.RecordFilters and shows the filtered group’s caption in the ExtraSection. Please refer to the sample and let us know if this serves your need. Regards, Calvin.

39832Up.zip

Prathima Venkobachar
Replied On March 22, 2006 07:23 PM UTC

Hi Calvin, Thank you very much for the solution you have suggested. The solution does seem to meet the requirement. I have a couple of queries pertaining to the implementation. 1) Is it possible to insert the new group header (Section object) at the same place where the filtering removed the group? In the sample, the first group (Nevada) was removed after filtering but the new group was appended towards the end. Is it possible to insert the new group at the beginning without keeping track of the index required to insert the new group? Because there are lots of groupings in our application and it is an arduous task to keep track of them. 2) When there are multiple groupings (without nested tables), how do we insert the new group header if it is situated inside another group? 3) After applying filter, the method this.grid.Update()seems to take considerable time. Is there a work-around to overcome that? Regards, Prathima

Administrator [Syncfusion]
Replied On March 24, 2006 12:12 PM UTC

Hi Prathima, 1) Yes, it is possible to insert a Extra Section at the top or at any position using the Sections.Insert() method. 2) Form the element the Parent Group can be retrieved and then the Extra Section can be added at that Group in the nested level groups. 3) The grid gets refreshed without the grid.Update() after applying filter so that can be avoided. I will update you with a sample soon. Regards, Calvin.

Prathima Venkobachar
Replied On March 24, 2006 01:59 PM UTC

Hi Calvin, Thanks for the update. I was aware of the Insert method to insert the elements. But it accepts the index at which the element should be inserted. Therefore I wanted to know if there was an easier way of determining the indices for which the groups were hidden because of the filter. It also makes sense in the case where there are multiple groupings. Regards, Mohan

Administrator [Syncfusion]
Replied On March 28, 2006 04:45 AM UTC

Hi Mohan, Sorry for the delayed response. The index of the display element will not be helpful here because the group.Sections collections does not hold the DetailsSections and so, the ExtraSections can be added at the top or at the bottom of the DetailsSections using the Sections.Insert() method. Please refer to the sample which adds the extra section for the Filtered group at the top of the DetailsSections, also for the nested level groups. Let us know if this helps. Regards, Calvin.

39832Modi.zip

Mohan
Replied On March 28, 2006 11:20 AM UTC

Hi Calvin, Thank you for the update and the sample project. Inserting the group at the top or at the bottom is not acceptable to the users since they expect the group to be displayed at the same place where it was before filtering. I was looking into previous posts and noticed the following http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=24341 that has the same requirement as mine. It is mentioned that Syncfusion would come up with an update in its next release. May I know if it is included in a patch or in version 4.1. It is extremely critical to my application and hence would be very helpful if you could include it in a patch. Regards, Mohan

Administrator [Syncfusion]
Replied On March 28, 2006 02:09 PM UTC

Hi Mohan, Thanks for the update. Yes the virtual Group.IsGroupVisible method and the GroupOptions.ShowEmptyGroups property were added in the latest patch (4.1.0.62). I have attached a sample using the Group.IsGroupVisible method. Regards, Calvin.

Updated0.zip

Mohan
Replied On March 29, 2006 12:21 PM UTC

Hi Calvin, Thanks a ton for the sample project. It works as expected for my application. I noticed that there is another property GridGroupOptionsStyleInfo.ShowEmptyGroups which when set to true does the same task of displaying groups even when the records underneath it are filtered out. Do you suggest more preference to one of these approaches just so that it would help me freeze the implementation? Regards, Mohan

Administrator [Syncfusion]
Replied On March 31, 2006 03:02 PM UTC

Hi Mohan, Sorry for the delayed response. The IsGroupVisible method is useful when you want some groups to be visible and other to be hidden, whereas the GridGroupOptionsStyleInfo.ShowEmptyGroups option will always show up groups even if there are no records. Let me know if this helps. Best Regards, Leo.

Administrator [Syncfusion]
Replied On April 4, 2006 02:05 PM UTC

Hi Leo, Thank you very much for the clarification. That answers my question. Regards, Mohan

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.

Warning Icon 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.Close Icon

;