Hello,
I am trying to find out how to make the DataGrid load properly.
The effect i am facing is that rows at grid are 'jumping' because looks like skip is not working properly.
What i am doing wrong? The heigth of the grid or row?
Hello,
I am trying to find out how to make the DataGrid load properly.
The effect i am facing is that rows at grid are 'jumping' because looks like skip is not working properly.
What i am doing wrong? The heigth of the grid or row?
We cannot tell what's the problem by looking at a screenshot. Check our forum FAQ on how to improve your post.
Hi.
Simply there is Virtualisation Enabled.
At Load Data I am fetching records from my service.
<RadzenDataGrid
@ref=GridControl
AllowRowSelectOnRowClick
@key=@($"{Evaluation.Id}_GRIDIN")
SelectionMode=@DataGridSelectionMode.Single
RowDoubleClick="@((r)=> RecordingDetails(r.Data.Recording))"
ColumnWidth="100px"
VirtualizationOverscanCount="20"
GotoFirstPageOnSort="true"
Sort=@OnSort AllowSorting
Style="max-height: 8000px;height: calc(100vh - 280px)"
AllowVirtualization
TItem="RecordingWithEvaluationRatingsModel"
Data=@(Recordings) Count=@(RecordingsCount)
LoadData=@(async (a) => await LoadRecordings(a, Evaluation))
AllowColumnResize="true"
EmptyText=@L["No records to display"]>
<Columns>
At LoadData
async Task LoadRecordings(LoadDataArgs args, LLMCallEvaluationModel evaluation)
{
if (Project == null || Settings == null) return;
try
{
SortDescriptor sort = null;
if (!string.IsNullOrEmpty(this._sortyBy))
{
sort = new SortDescriptor();
sort.Property = this._sortyBy;
sort.SortOrder = _sortOrder;
}
var filterProjests = Project != null ? new[] { Project?.Id.ToString() ?? string.Empty } : null;
var result = await _client.GetRecordingsWithEvaluationOrder(evaluationId: evaluation.Id, projectId: Project.Id.ToString(), from: _filterFrom, to: _filterTo,
offset: args.Skip, howManyRecords: args.Top, sortBy: sort != null ? sort.Property : "", sortOrder: sort != null ? sort.SortOrder.ToString() : "", filterRatingId: _sortyByRatingId);
this.Recordings = result.Models.ToList().Select(_ => new RecordingWithEvaluationRatingsModel()
{
Recording = _,
Ratings = !string.IsNullOrEmpty(_.Evaluations) ? _.Evaluations.FromJson<CallEvaluationResult>() : null
}).ToList ();
this.RecordingsCount = result.TotalCount;
await base._jsLog.LogAsync($"<{evaluation.Id}> Top: {args.Top} Skip: {args.Skip} Cnt: {Recordings?.Count()} TotalCount: {result.TotalCount} SortBy: {_sortyBy} Order: {_sortOrder}");
await base.InvokeStateHasChanged();
return;
}
catch (Exception cex)
{
NotificationService.Notify(severity: NotificationSeverity.Error, summary: L["Server Communication Error"], detail: "LoadRecordings");
}
}
And its working like that:
Initial Load is done properly.
Then When i do scroll
LoadData is called but the 'skip' is 0 or 1 and data is jumping at grid like loading from the beginning - but the scroll is moved down for 20 rows for example. Later when i go down skip is increasing but still not enougth to be in sync with the scroll bar.
I think its related to some heigth calculcation as the scroll margins are not adeqate to total items count.
I don’t see Count set anywhere.
hello
Its there:
Count=@(RecordingsCount)
this.RecordingsCount = result.TotalCount;
I just added that the scroll is going way behind items count - my columns using Template so i think there is some calculation issue -
No its ok sorry - wrongly counted so the scroll is calculated properly just the skip is going crazy.