Sample Source:-
SessionName PaymentMethod Amount
Session-1 Cash 100Session-1 Cash 70Session-1 Cheque 50Session-2 Cash 500
I have created sorted columns for SessionName and PaymentMethod and created summary for Amount. customize the group by row description in the InitializeGroupByRow event.
Output:-
Amount - Change to Session Name**************************- Session - 1 - Method: Cash(2 items) Amount Paid = $170.00 100.0000 - Need to hide 70.0000 - Need to hide - Method: Cheque(1 item) Amount Paid = $50.00
- Session - 2 - Method: Cash(1 item) Amount Paid = $500.00 500.00 - Need to hide
1) I want to hide the summary record, since amount total displaying in the group description.2) Column header need to display as "Session Name"
Thanks
satheesh_aaa said:1) I want to hide the summary record, since amount total displaying in the group description.
If you want to hide the summaries so that they only display in the groupByRow and not after the data rows, then you could use the SummaryDisplayAreas property. You would set it to InGroupByRows.
satheesh_aaa said:2) Column header need to display as "Session Name"
Se the column.Header.Caption property.
I tried what you suggested, summary information is displaying in the group by row, but still Non-Group by rows are displaying below the group by rows.
- Session - 1 - Method: Cash(2 items) Amount Paid = $170.00 100.0000 - Need to hide 70.0000 - Need to hide - Method: Cheque(1 item) Amount Paid = $50.00 50
I want to hide non-group by rows, that is 100, 70 in cash method and 50 in cheque method.
Hi,
There's no way to hide the data rows and still show the GroupByRows.But you can stop them from expanding.
What you do is set grid.DisplayLayout.Override.GroupByRowExpansionStyle to Disabled.
Then you handle the InitializeGroupByRow event and set e.Row.Expanded to False.
This way, all GroupByRows are collapsed and the user cannot expand them.
Great... Achieved what I expected...Thanks Mike Saltzman
This is more complicated, you can't do it via property settings.
You can stop the rows from expanding like so:
private void ultraGrid1_BeforeRowExpanded(object sender, CancelableRowEventArgs e) { UltraGridGroupByRow row = e.Row as UltraGridGroupByRow; if (row != null && row.Column.Key == "Session") e.Cancel = true; }
To remove the Expansion indicators on just the second level GroupByRows, you will need a CreationFilter.
public class MyCreationFilter : IUIElementCreationFilter { #region IUIElementCreationFilter Members void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent) { // Watch for a GroupByRowUIElement if (parent is GroupByRowUIElement) { // Get the UltraGridGroupByRow UltraGridGroupByRow row = parent.GetContext(typeof(UltraGridGroupByRow)) as UltraGridGroupByRow; if (row != null && row.Column.Key == "Session") { // Find the GroupByRowExpansionIndicatorUIElement inside the element. GroupByRowExpansionIndicatorUIElement groupByRowExpansionIndicatorUIElement = parent.GetDescendant(typeof(GroupByRowExpansionIndicatorUIElement)) as GroupByRowExpansionIndicatorUIElement; if (groupByRowExpansionIndicatorUIElement != null) { // Remove the expansion indicator element. parent.ChildElements.Remove(groupByRowExpansionIndicatorUIElement); // Shift the text over to the left to reclaim the space left by the expansion indicator. GroupByRowDescriptionUIElement groupByRowDescriptionUIElement = parent.GetDescendant(typeof(GroupByRowDescriptionUIElement)) as GroupByRowDescriptionUIElement; groupByRowDescriptionUIElement.Rect = new Rectangle( groupByRowDescriptionUIElement.Rect.X - groupByRowExpansionIndicatorUIElement.Rect.Width, groupByRowDescriptionUIElement.Rect.Y, groupByRowDescriptionUIElement.Rect.Width + groupByRowExpansionIndicatorUIElement.Rect.Width, groupByRowDescriptionUIElement.Rect.Height); } } } } bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent) { // do nothing. return false; } #endregion }
I am grouping by two levels, one is session level and another is payment method level. If I set GroupByRowExpansionStyle to Disabled then entire group expansion style get disabled. User can able to expand the row by sessionlevel not the payment method level. Is there way to handle this scenario?
The output looks like
Session Name-------------------------- Session - 1 Method:Cash (2 Items) Amount Paid = $170 Method:Cheque (2 Items) Amount Paid = $100
- Session - 2 Method:Cash (2 Items) Amount Paid = $170
+ Session - 3