sfdatagrid GridTableSummaryRow always 0

This is what source look like: 



<syncfusion:SfDataGrid Name="DataGrid1" Grid.Row="1" Style="{StaticResource SfDataGridStyleBase}"
                               RowStyle="{StaticResource SfDataGridRowStyleBase}">
            <syncfusion:SfDataGrid.TableSummaryRows>
                <syncfusion:GridTableSummaryRow ShowSummaryInRow="False" Position="Bottom">
                    <syncfusion:GridSummaryRow.SummaryColumns>
                        <syncfusion:GridSummaryColumn Name="Sum"
                                        Format="{Count:d}"
                                        MappingName="Id"
                                        SummaryType="CountAggregate" />
                    syncfusion:GridSummaryRow.SummaryColumns>
                syncfusion:GridTableSummaryRow>
            syncfusion:SfDataGrid.TableSummaryRows>
 
            <syncfusion:SfDataGrid.Columns>
                <syncfusion:GridTemplateColumn AllowSorting="False" AllowFiltering="False" Width="60">
                    <syncfusion:GridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="Cancel" Command="{Binding UserInfoVM.CancelChangedCommand,Source={StaticResource Locator}}" Margin="1" />
                        DataTemplate>
                    syncfusion:GridTemplateColumn.CellTemplate>
                syncfusion:GridTemplateColumn>
                <syncfusion:GridTextColumn HeaderText="ID" DisplayBinding="{Binding Id}" />
                <syncfusion:GridTextColumn HeaderText="Name" DisplayBinding="{Binding Name}" />
                <syncfusion:GridTextColumn HeaderText="State" DisplayBinding="{Binding State,Converter={StaticResource MyModelStatusConverter},UpdateSourceTrigger=PropertyChanged}" />
            syncfusion:SfDataGrid.Columns>
        syncfusion:SfDataGrid>








Thank you.

7 Replies

JG Jai Ganesh S Syncfusion Team November 8, 2017 09:43 AM UTC

Hi Renruofan, 
We have checked your code snippet and in that you have wrongly set the format for TableSummary.  
<syncfusion:GridTableSummaryRow ShowSummaryInRow="False" Position="Bottom"> 
                    <syncfusion:GridSummaryRow.SummaryColumns> 
                        <syncfusion:GridSummaryColumn Name="Sum" 
                                        Format="{Count:d}" 
                                        MappingName="Id" 
                                        SummaryType="CountAggregate" /> 
                    <syncfusion:GridSummaryRow.SummaryColumns> 
                <syncfusion:GridTableSummaryRow> 
 <syncfusion:SfDataGrid.TableSummaryRows> 
 
 
You have to set the format for the TableSummaryColumn like below, 
<syncfusion:GridTableSummaryRow Position="Bottom" ShowSummaryInRow="False"> 
                        <syncfusion:GridTableSummaryRow.SummaryColumns> 
                            <syncfusion:GridSummaryColumn Name="Sum" 
                                                          Format="'{Count:d}'" 
                                                          MappingName="QS1" 
                                                          SummaryType="CountAggregate" /> 
                            
                        </syncfusion:GridTableSummaryRow.SummaryColumns> 
</syncfusion:GridTableSummaryRow> 
 
Please refer the below UG documentation to know more details on Table Summary. 
Please let us know if you have any further questions.

Regards,
Jai Ganesh S 



RE renruofan November 9, 2017 03:33 AM UTC

Thank you for your reply.

I've modify my source, but it still not work.

What are the possible problems?

BTW:I'm using MVVMLight frame.



JG Jai Ganesh S Syncfusion Team November 10, 2017 05:12 PM UTC

Hi Renruofan, 
 
We have prepared a sample for using MVVMLight frame but we are unable to reproduce the issue and the Table Summary row shows correctly in our end. 
 
 
Could you please check the above sample and if you are still facing the issue then please modify the above sample to replicate the issue. This would be more helpful for us to proceed further. 

Regards, 
Jai Ganesh S


RE renruofan November 14, 2017 05:16 AM UTC

Thank you for your reply.


According to your demo, I've found the problem actually.


In constructed function, there is no problem.After I clear the collection, and add new item into the collection, the summary row is not work.


I've uploaded demo in this reply.


Thank you.


Attachment: SfDataGridMVVMLight_Changed_f9b2638a.rar


JG Jai Ganesh S Syncfusion Team November 14, 2017 12:12 PM UTC

Hi Renruofan, 
 
You can achieve your requirement for updating the GridTableSummaryRow total while adding a new record in a collection by setting the LiveDataUpdateMode as AllowSummaryUpdate in SfDataGrid,  
  
<Syncfusion:SfDataGrid Margin="10" Name="MyDataGrid" 
                  ItemsSource="{Binding GDCSource}"  
                  ColumnSizer="Star"  
                  AutoGenerateColumns="False"  
                  LiveDataUpdateMode="AllowSummaryUpdate" 
                  /> 
  
  
Regards,  
Jai Ganesh S


RE renruofan November 16, 2017 05:11 AM UTC

After I add LiveDataUpdateMode="AllowSummaryUpdate" , it worked!
Thank you!
You help me a lot.


JG Jai Ganesh S Syncfusion Team November 17, 2017 04:02 AM UTC

Hi Renruofan,  
 
Thank you for the update. 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Jai Ganesh S

Loader.
Up arrow icon