Fix persisted data table page sizes
This commit is contained in:
parent
6e954ff5b8
commit
c292979010
1 changed files with 13 additions and 2 deletions
|
|
@ -171,16 +171,27 @@
|
|||
{
|
||||
if (firstRender)
|
||||
{
|
||||
int? storedPageSize = null;
|
||||
|
||||
try
|
||||
{
|
||||
var storedSize = await JSRuntime.InvokeAsync<string>("localStorage.getItem", "DataTablePageSize");
|
||||
|
||||
if (!string.IsNullOrEmpty(storedSize) && int.TryParse(storedSize, out var size) && size > 0)
|
||||
PageSize = size;
|
||||
storedPageSize = size;
|
||||
}
|
||||
catch { }
|
||||
|
||||
await OnChange.InvokeAsync();
|
||||
if (storedPageSize.HasValue)
|
||||
{
|
||||
PageSize = storedPageSize.Value;
|
||||
|
||||
await ReloadAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await OnChange.InvokeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue