Weird Binding Issue with Grid

I have a grid that is bound to a ObservableCollection that's data changes when a user selects certain options in a dropdown.  (The Query part works perfectly)  It works fine as long as the query returns one or more rows, the Grid updates the way it shold.  If the query returns no rows, about 50%/very sporadically, even though the ObservableCollection reports 0 rows from the Query, the Grid does not update and continues to show the old data.  I even tried this with a test and put a button on the form that runs the following procedure:

 private void TestRemoveAll()
    {
        ts.Clear();
        StateHasChanged();
        grdTS.Refresh();
        var x = grdTS.CurrentViewData.Count();
    }

If ts originally had data, when this button is pushed at the end of the procedure ts.Count will equal 0 (Correct), but x will equal whatever the Count was before and the Grid will show the old data and not empty.  To make matters worse is it only happens sporadically, some times it works fine.    

<SfGrid DataSource="@ts" @ref="grdTS" Height="400" Toolbar="@gp.Toolbar">
.....

    public ObservableCollection<TimeSheets> ts { get; set; }

The query call: (works fine)
                    ts = new ObservableCollection<TimeSheets>(await db.TimeSheets.Where(a => a.EmpId == Emp).Where(a => a.DateStart >= dateFrom && a.DateEnd <= dateTo).OrderBy(a => a.DateStart).AsNoTracking().ToListAsync());

Is there a way to manual empty out the grid, say like: grdTS.RemoveAll()?

Thanks,
Mike



2 Replies 1 reply marked as answer

ML Michael Lambert October 7, 2020 01:24 AM UTC

This issue seems to have be resolved with 18.3.35..

Marked as answer

JP Jeevakanth Palaniappan Syncfusion Team October 7, 2020 11:22 AM UTC

Hi Michael, 

We are happy to know that your issue has been resolved in the latest version. Please get back to us if you have any other queries. 

Regards, 
Jeevakanth SP. 


Loader.
Up arrow icon