Refresh summaries when data changed

Salve a tutti,

sto utilizzando una sfdatagrid con TableSummaryRows.

Se modifico il valore in una cella il totale non si aggiorna.

Cosa mi sfugge?


Allego il codice di definizione della sfdatagrd

"

           With sfdgVisualizzaAnalisi

               .SuspendLayout()

               .Columns().Clear()

               'setup grid column

               .AutoGenerateColumns = False 'True '*********************************

               .AutoSizeColumnsMode = AutoSizeColumnsMode.None

                Dim numberFormat As NumberFormatInfo = TryCast(Application.CurrentCulture.NumberFormat.Clone(), NumberFormatInfo)

                numberFormat.NumberDecimalDigits = 2

                numberFormat.CurrencyDecimalDigits = 2

                numberFormat.CurrencyDecimalSeparator = ","

                numberFormat.PercentDecimalDigits = 2

                .Columns.Add(New GridNumericColumn() With {.MappingName = "K", .HeaderText = "K", .FormatMode = FormatMode.Numeric, .NumberFormatInfo = numberFormat, .AllowEditing = True, .MinimumWidth = 100})

                .SummaryCalculationMode = CalculationMode.OnDemandCaptionSummary Or CalculationMode.OnDemandGroupSummary

                ' Creates the TableSummaryRow2.

                Dim tableSummaryRow2 As New GridTableSummaryRow With {

                    .ShowSummaryInRow = False,

                    .Position = VerticalPosition.Bottom,

                    .Title = "Totali: ",

                    .TitleColumnCount = 1,

                    .CalculationUnit = SummaryCalculationUnit.AllRows

                }


                .Style.TableSummaryRowStyle.BackColor = Color.LightGray

                .Style.TableSummaryRowStyle.Font = New GridFontInfo(New Font("Arial", 8.0F, FontStyle.Bold))

                .Style.TableSummaryRowStyle.HorizontalAlignment = HorizontalAlignment.Right

                .Style.GroupSummaryRowStyle.BackColor = Color.LightGray

                .Style.GroupSummaryRowStyle.Font = New GridFontInfo(New Font("Arial", 8.0F, FontStyle.Bold))

                .Style.GroupSummaryRowStyle.HorizontalAlignment = HorizontalAlignment.Right

                'Aggiunge alla tabella i vari totali richiesti

                tableSummaryRow2.SummaryColumns.Add(New GridSummaryColumn With {.Name = "H", .MappingName = "H", .Format = "{Sum:n2}", .SummaryType = SummaryType.DoubleAggregate})

                ' Adds the GridTableSummaryRow in the TableSummaryRows collection.

                .TableSummaryRows.Add(tableSummaryRow2)

                .GroupSummaryRows.Add(tableSummaryRow2)

                AddHandler .CurrentCellEndEdit, AddressOf OnCurrentCellEndEdit

                .AutoSizeColumnsMode = AutoSizeColumnsMode.Fill

                .ClearSelection()

                .ResumeLayout()

                'Imposto la sorgente di dati

                .DataSource = adt



9 Replies

VS Vijayarasan Sivanandham Syncfusion Team September 8, 2023 02:14 PM UTC

Hi Logiware,

Your requirement to update the TableSummaryRows value based on the value changed in SfDataGrid can be achieved by setting the LiveDataUpdateMode property as AllowDataShaping. Refer to the below code snippet,

'Set the AllowDataShaping for SfDataGrid.LiveDataUpdateMode property to refresh the sorting, filtering, grouping and summaries

SfDataGrid.LiveDataUpdateMode = LiveDataUpdateMode.AllowDataShaping


UG Link: DataManipulation | DataGrid | WinForms | Syncfusion

Find the sample demo in the attachment.

Regards,
Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Sample_5b0816a2.zip


LO Logiware September 11, 2023 07:25 AM UTC

Thank you for your reply. 

Unfortunately it does not work for me. 

Also inserting, as you suggested, . LiveDataUpdateMode = LiveDataUpdateMode.AllowDataShaping or

. LiveDataUpdateMode=LiveDataUpdateMode.AllowSummaryUpdate the summary does not change.

It updates if, after changing the value in a cell, I perform a grouping and then remove it.



VS Vijayarasan Sivanandham Syncfusion Team September 12, 2023 01:51 PM UTC

Logiware,

We have checked the reported issue with the provided details, but we are unable to reproduce the reported issue on our end.
TableSummaryRows value is updated properly based on the value changed in SfDataGrid. Here we have attached the tested sample and video demo. Please have a look at this. If you are still facing the reported issue, modify the attached sample based on your scenario. It will be helpful for us to proceed further.


Attachment: Sample_And_Video_demo_d0b87afc.zip


LO Logiware September 13, 2023 03:11 PM UTC

Hi.

The scenario would seem to be the same, only the result is different.

I attach the video. 

I just can't understand. 

Thank you very much.


Attachment: Registrazione_20230913_170539_3dbc9bf9.zip


VS Vijayarasan Sivanandham Syncfusion Team September 14, 2023 06:12 PM UTC

Logiware,

We are able to understand your reported scenario.
Can you please provide more information related to your query?
        1.
Details about the machine configuration of issue issue-produced system?
        2.
Details about a screenshot of the Operating System used in issue produced system?
        3. Details about a screenshot of Microsoft Studio Visual Version used in issue produced system?
        4.
Code snippet related to the underlying model and collection that bound with SfDataGrid
        5.
Share the details about the Syncfusion version.   
     

It will be helpful for us to check on it and provide you with a solution as soon as possible.



LO Logiware September 15, 2023 07:21 AM UTC

Hi,

I attach the requested data. I remain available for any clarification. Thank you


Attachment: DatiRichiesti_c491efa3.zip


VS Vijayarasan Sivanandham Syncfusion Team September 18, 2023 05:13 PM UTC

Logiware,

We regret to let you know that it is not possible to find the exact cause for the reported issue without reproducing it on our end and only with the provided details.

However, we have prepared the sample based on a provided code snippet and checked the reported issue “TableSummaryRows value is updated properly based on the value changed in SfDataGrid” and were unable to replicate the issue from our end. We have tested the sample details shared with the mentioned environment. It is working fine as expected. Please find the tested sample demo in the attachment. Please have a look at this. Otherwise, try to reproduce the reported issue in this sample and revert to us with the modified sample. It will be more helpful for us to find the exact cause of the issue and to provide a prompt solution.

Note: Find the backup database in the attachment. You need to restore the database and utilize it according to your scenario. The LiveDataUpdateMode is not supported in a few cases, and we have mentioned this limitation in our user guide documentation. The link to the documentation is given below.

UG Link: DataManipulation | DataGrid | WinForms | Syncfusion



Attachment: SfDataGidDemo_19f12009.zip


MG Mohammed Gheiaty replied to Vijayarasan Sivanandham April 24, 2024 09:14 PM UTC

in the properties window i select LiveUpdateMode.AllowSummaryUpdate , and it work



SB Sweatha Bharathi Syncfusion Team April 25, 2024 02:19 PM UTC

Mohammed Gheiaty,


Glad that your issue is resolved!! We are closing this ticket now. Please  open a new ticket if you need any assistance.





Loader.
Up arrow icon