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

Invalidate unbound row not working

I've created a simple unbound row which display the sum of all integers in a column. When the unbound row is not shown within the data grid view, and any value is edited, the sum in the unbound row is not updated right away. When I hit the remove item button until the unbound row at the bottom comes into view, at one point the value shown wouldn't be updated.

To reproduce:

  1. Edit the "Price" value on the 1st item, scroll down to view the updated unbound row (sum)
  2. Scroll back up and edit the 2nd item, click "remove" button twice until the unbound row comes into view

Result: The value shown in unbound row remains as the value in Step 1 and it will only be updated when the scrollbar is clicked.


Attachment: UnboundRow_issue_withAddRemoveBtn_b5bdc1e3.zip

5 Replies

DM Dhanasekar Mohanraj Syncfusion Team November 7, 2022 09:16 AM

Currently, we are checking the feasibility to achieve your requirement. We need two more business days to validate this. We will update you with further details on November 09, 2022.



DM Dhanasekar Mohanraj Syncfusion Team November 9, 2022 10:59 AM

Still, we are checking the feasibility to achieve your requirement. We will update you with further details on November 11, 2022.



DM Dhanasekar Mohanraj Syncfusion Team November 11, 2022 09:59 AM

Still, we are checking the feasibility to resolve the reported issue at the sample level. We need two more business days to validate this. We will check and update you with further details on November 15, 2022.



DM Dhanasekar Mohanraj Syncfusion Team November 15, 2022 10:57 AM

As we mentioned earlier, the unbound row values do not update automatically while modifying the data. We need to update this manually, currently, we are checking the possible way to achieve your requirement at the sample level. We will update you with further details on November 18, 2022.



DM Dhanasekar Mohanraj Syncfusion Team November 18, 2022 09:38 AM

Alison Tan, On further analysis, you can achieve your requirement to update the unbound row values while changing the dependent data values will be achievable by overriding the OnRender method by using the custom renderer shown below,

this.sfDataGrid1.UnboundRowCellRenderers.Remove("UnboundRowCell");

this.sfDataGrid1.UnboundRowCellRenderers.Add("UnboundRowCell", new UnboundCellRenderer());

public class UnboundCellRenderer : GridUnboundCellRenderer

{

    

    protected override void OnRender(

       Graphics paint,

       Rectangle cellRect,

       string cellValue,

       CellStyleInfo style,

       DataColumnBase column, RowColumnIndex rowColumnIndex)

    {

        if (column.GridColumn.MappingName == "Price")

        {

            ObservableCollection<OrderInfo> dataGridOrders = (column.UnboundRowInfo.OriginalSender as SfDataGrid).DataSource as ObservableCollection<OrderInfo>;

            cellValue = dataGridOrders.Sum(items => items.Price).ToString("0.00");

        }

        base.OnRender(paint, cellRect, cellValue, style, column, rowColumnIndex);

    }

}



Here we have modified the provided sample based on your scenario. Please have a look at this.

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


Attachment: UnboundRow_issue_91452d41.zip

Loader.
Live Chat Icon For mobile
Up arrow icon