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

Grid Grouping Control Capabilities

Hi. I just wanted to know if the Grid Grouping Control supported subtotaling per each grouped item.

For example, if I'm binding data to this Grid Grouping Control and one of my columns is called Department and some of it's values are "Human Resources", "Sales" and "IT",  can I group this data based on the Department field and get a subtotal of it's Expenses and display it next to its respective department?

Can you clarify this?

Thanks!

10 Replies

AK Arun Kumar V Syncfusion Team June 18, 2015 03:45 AM UTC

Hi Ari Case,

Thanks for your interest in Syncfusion products.

The reported behavior to achieve the grouped records collection summary is explained clearly in the following sample.

Code Snippet
:
//Adding the SummaryRows to the TableDescriptor
            this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new Syncfusion.Windows.Forms.Grid.Grouping.GridSummaryRowDescriptor("Row 1", new Syncfusion.Windows.Forms.Grid.Grouping.GridSummaryColumnDescriptor[] {
                new Syncfusion.Windows.Forms.Grid.Grouping.GridSummaryColumnDescriptor("Won", Syncfusion.Grouping.SummaryType.Int32Aggregate, "wins", "{Sum}"),
                new Syncfusion.Windows.Forms.Grid.Grouping.GridSummaryColumnDescriptor("Lost", Syncfusion.Grouping.SummaryType.Int32Aggregate, "losses", "{Sum}")}));



Sample Path: <InstalledLocation>\Syncfusion\EssentialStudio\<InstalledVersion>\Windows\Grid.Grouping.Windows\Samples\Summaries\Getting Started


Please let me know if you have any concerns.

Regards,
Arun.


AC Ari Case June 24, 2015 07:22 PM UTC

Is this available in WPF?


AN Ashok N Syncfusion Team June 26, 2015 12:46 AM UTC

Hi Ari,

We are sorry about the inconvenience caused.

We have analyzed your query and In WPF platform you can use SfDataGrid for grid grouping. Using SfDataGrid control you can achieve your requirement by using SfDataGrid.GroupSummaryRows. Please refer the below code snippet for achieving your requirement.

<syncfusion:SfDataGrid.GroupSummaryRows>

    <syncfusion:GridSummaryRow ShowSummaryInRow="False">

        <syncfusion:GridSummaryRow.SummaryColumns>

            <syncfusion:GridSummaryColumn Name="OrderCount"

                                              Format="'{Sum:d}'"

                                              MappingName="OrderCount"

                                              SummaryType="Int32Aggregate"/>

        </syncfusion:GridSummaryRow.SummaryColumns>

    </syncfusion:GridSummaryRow>

</syncfusion:SfDataGrid.GroupSummaryRows>

Sample location: http://www.syncfusion.com/downloads/support/forum/119399/ze/SimpleApplication-1508516232

Please refer to the following UG link and find more details about summaries in SfDataGrid (WPF platform):

http://help.syncfusion.com/ug/wpf/index.html#!Documents/summaries.htm

Please let us know, if you require further assistance.

Thanks,

Ashok



AC Ari Case June 29, 2015 04:31 PM UTC

Thanks for this.

Is there built-in front-end validation on this grid?

For example if I wanted to set a validation rule saying if column 1 has a value of "Blue" and column 2 is blank (""), then prompt the user that this isn't valid and keep them on that same record, is that doable or is that just something I'd take care of in the back-end code?


AC Ari Case June 29, 2015 04:42 PM UTC

Also, I'm running into a weird issue with my GridComboBoxColumn on the sfDataGrid:

XAML:

<syncfusion:GridComboBoxColumn x:Name="cbxMonth" HeaderText="Month" MappingName="month" AllowEditing="True" ></syncfusion:GridComboBoxColumn>


My DataTable has 2 columns, "id" with values from 1-12 and "month" which contains all months from Jan-Dec:

 cbxMonth.ItemsSource = dtMonths.DefaultView;
 cbxMonth.DisplayMemberPath = "month";
 cbxMonth.SelectedValuePath = "id";


The combobox isn't visible unless I double-click the cell which is a problem, I should see it when the grid first loads. The combobox does bind and have it's ItemSource properly set but I need to be able to see the combobox with it's DisplayMemberPath showing on Grid's initial load, I shouldn't have to double-click first.

Thanks


AC Ari Case June 30, 2015 01:21 PM UTC

Any update on this? I'm working on a time sensitive project so the sooner the response the better.

Thanks!


AC Ari Case June 30, 2015 06:03 PM UTC

One more thing, you can ignore my question about validation, I found that the SfDataGrid has a validation event.

For my current issue with the combo box on the SfDataGrid, my application's version of the "Syncfusion.SfGrid.WPF" reference file is 12.2400.0.36 while the most up to date version is 13.1.0.21
 
Could this be what's causing the combobox to not show on the grid?


AN Ashok N Syncfusion Team June 30, 2015 06:07 PM UTC

Hi Ari,

We are sorry about the inconvenienced caused.

Internally we have loaded the content control in GridComboBoxColumn in non-editable (display) mode and while editing the cell only, ComboBox will be loaded. So you can achieve your requirement to display the drop down arrow in ComboBox column by customizing the GridCell style and set that CellStyle to GridComboBoxColumn. Please refer the below code example:

<Style x:Key="style1" TargetType="syncfusion:GridCell">

<Setter Property="Template">

<Setter.Value>

<ControlTemplate TargetType="syncfusion:GridCell">

<Grid SnapsToDevicePixels="True">

<VisualStateManager.VisualStateGroups>

<VisualStateGroup x:Name="IndicationStates">

<Border Background="{TemplateBinding Background}"

BorderBrush="{TemplateBinding BorderBrush}"

BorderThickness="{TemplateBinding BorderThickness}"

SnapsToDevicePixels="True">

-------------------------------------------

-------------------------------------------

<Grid>

<ContentPresenter Margin="{TemplateBinding Padding}" />

<Path Width="5.3"

Height="4.2"

Margin="0,0,7,0"

HorizontalAlignment="Right"

VerticalAlignment="Center"

Data="F1M0,0L2.667,2.66665 5.3334,0 5.3334,-1.78168 2.6667,0.88501 0,-1.78168 0,0z"

Fill="Gray"

Stretch="Uniform" />

</Grid>

</Border>

-----------------------------------------

----------------------------------------

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

You can load the ComboBox in single click by setting EditTrigger as OnTap in SfDataGrid definition and set StaysOpenOnEdit as True in GridComboBoxColumn definition. For your reference we have attached the sample in the following location, please refer it.
Sample link: http://www.syncfusion.com/downloads/support/forum/119399/ze/ComboBox_WPF195330021

Please let us know if you require further assistance.

Thanks,

Ashok



AC Ari Case July 1, 2015 02:23 PM UTC

Thanks this did work...it just seems like a lot of lines of code to get a simple drop down control to work on the grid.

But that did resolve this, thanks.


SC Saranya CJ Syncfusion Team July 2, 2015 05:22 AM UTC

Hi Ari Case,

Thank you for your update. Please let us know if you require any other assistance.

Regards,
Saranya
 

Loader.
Live Chat Icon For mobile
Up arrow icon