I have this grid bound to TheDocumentList:
<SfGrid @ref=_documentListGrid Width="100%" DataSource="@TheDocumentList" Toolbar="@(new List<string>() { "Add", "Delete" })" AllowPaging="true" AllowFiltering="true" AllowSorting="true" AllowResizing="true" RowHeight="25">
...
I have a background task to create a new issue of a document, and this is added to the list of documents
await WaitForDocumentTaskToFinish("WebCreateNextIssueTasks", taskId, "Creating Next Issue", "Please wait while the next issue is being created");
await RefreshDocumentsList(); // Reload the document list with the new issue included
await _documentListGrid.Refresh(true); // Refresh the document list grid
if (TheDocumentList != null)
{
// This finds the document with the highest DocId, which is the new issue document just created (DocId=1006 in my case)
var testFindNewDocumentIssue = TheDocumentList.OrderByDescending(d => d.DocId).FirstOrDefault();
// This now finds 41 documents in the source list, which includes the new issue document
var numDocsInSource = TheDocumentList.Count;
// This should find the new document in the grid data source, which should be the same as testFindNewDocumentIssue - but it is not (This still has DocId=1005)
var testFindNewDocumentInGridData = _documentListGrid.DataSource.Cast<CDBDocumentList>().OrderByDescending(d =>d.DocId).FirstOrDefault(); // This should be the same as testFindNewDocumentIssue
// This now finds the number of documents in the grid data source - only 40 documents are found, not 41
var numDocsInGrid = _documentListGrid.DataSource.Cast<CDBDocumentList>().Count();
}
Why does the _documentsListGrid not get the new record loaded??