Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.6.2</Version>
<Version>10.6.3</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/BootstrapBlazor/Components/Table/Table.razor.Edit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,8 @@ protected async Task QueryData(bool triggerByPagination = false, bool firstQuery
var queryOption = BuildQueryPageOptions(firstQuery);
queryOption.IsTriggerByPagination = triggerByPagination;

if (DynamicContext != null)

if (OnQueryAsync == null && typeof(TItem).IsAssignableTo(typeof(IDynamicObject)))
{
QueryDynamicItems(queryOption, DynamicContext, isAutoQuery);
}
Expand Down
31 changes: 17 additions & 14 deletions src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,26 +1237,29 @@ private void ResetDynamicContext()
}
}

private void QueryDynamicItems(QueryPageOptions queryOption, IDynamicObjectContext context, bool isAutoQuery = true)
private void QueryDynamicItems(QueryPageOptions queryOption, IDynamicObjectContext? context, bool isAutoQuery = true)
{
if (isAutoQuery)
{
_rowsCache = null;
var items = context.GetItems();
if (context.OnFilterCallback != null)
if (context != null)
{
Comment on lines +1240 to 1246
items = context.OnFilterCallback(queryOption, items);
}
if (IsPagination)
{
TotalCount = items.Count();
PageCount = (int)Math.Ceiling(TotalCount * 1.0 / Math.Max(1, _pageItems));
PageIndex = GetSafePageIndex();
items = items.Skip((PageIndex - 1) * _pageItems).Take(_pageItems);
}
QueryItems = items.Cast<TItem>().ToList();
var items = context.GetItems();
if (context.OnFilterCallback != null)
{
items = context.OnFilterCallback(queryOption, items);
}
if (IsPagination)
{
TotalCount = items.Count();
PageCount = (int)Math.Ceiling(TotalCount * 1.0 / Math.Max(1, _pageItems));
PageIndex = GetSafePageIndex();
items = items.Skip((PageIndex - 1) * _pageItems).Take(_pageItems);
}
QueryItems = items.Cast<TItem>().ToList();

ResetSelectedRows(QueryItems);
ResetSelectedRows(QueryItems);
}
}
}

Expand Down
Loading