optimize Pager search to remove redundant AllowSearch parameter and avoid consuming memory when not in use
This commit is contained in:
parent
6140743769
commit
b77e72880b
|
@ -29,7 +29,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<Pager Items="@_files" AllowSearch="True" SearchProperties="Name">
|
||||
<Pager Items="@_files" SearchProperties="Name">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
|
|
|
@ -15,7 +15,7 @@ else
|
|||
<br />
|
||||
<br />
|
||||
|
||||
<Pager Items="@_jobs" AllowSearch="True" SearchProperties="Name">
|
||||
<Pager Items="@_jobs" SearchProperties="Name">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
|
|
|
@ -14,7 +14,7 @@ else
|
|||
{
|
||||
<ActionLink Action="Add" Text="Add Language" ResourceKey="AddLanguage" />
|
||||
|
||||
<Pager Items="@_languages" AllowSearch="True" SearchProperties="Name,Code">
|
||||
<Pager Items="@_languages" SearchProperties="Name,Code">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>@SharedLocalizer["Name"]</th>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{
|
||||
<ActionLink Action="Add" Text="Add Page" ResourceKey="AddPage" />
|
||||
|
||||
<Pager Items="@PageState.Pages.Where(item => !item.IsDeleted)" AllowSearch="True" SearchProperties="Name">
|
||||
<Pager Items="@PageState.Pages.Where(item => !item.IsDeleted)" SearchProperties="Name">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
|
|
|
@ -12,7 +12,7 @@ else
|
|||
{
|
||||
<ActionLink Action="Add" Text="Add Profile" Security="SecurityAccessLevel.Edit" ResourceKey="AddProfile" />
|
||||
|
||||
<Pager Items="@_profiles" AllowSearch="True" SearchProperties="Title,Category">
|
||||
<Pager Items="@_profiles" SearchProperties="Title,Category">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
|
|
|
@ -12,7 +12,7 @@ else
|
|||
{
|
||||
<ActionLink Action="Add" Text="Add Role" Security="SecurityAccessLevel.Edit" ResourceKey="AddRole" />
|
||||
|
||||
<Pager Items="@_roles" AllowSearch="True" SearchProperties="Name">
|
||||
<Pager Items="@_roles" SearchProperties="Name">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
|
|
|
@ -14,7 +14,7 @@ else
|
|||
{
|
||||
<ActionLink Action="Add" Text="Add Site" ResourceKey="AddSite" />
|
||||
|
||||
<Pager Items="@_sites" AllowSearch="True" SearchProperties="Name">
|
||||
<Pager Items="@_sites" SearchProperties="Name">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
|
|
|
@ -28,7 +28,7 @@ else
|
|||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<Pager Items="@_urlMappings" AllowSearch="True" SearchProperties="Url">
|
||||
<Pager Items="@_urlMappings" SearchProperties="Url">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
|
|
|
@ -20,7 +20,7 @@ else
|
|||
<ActionLink Action="Add" Text="Add User" Security="SecurityAccessLevel.Edit" ResourceKey="AddUser" />
|
||||
<ActionLink Text="Import Users" Class="btn btn-secondary ms-2" Action="Users" Security="SecurityAccessLevel.Admin" ResourceKey="ImportUsers"/>
|
||||
|
||||
<Pager Items="@users" RowClass="align-middle" AllowSearch="True" SearchProperties="Username,Email,DisplayName">
|
||||
<Pager Items="@users" RowClass="align-middle" SearchProperties="Username,Email,DisplayName">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
@if (ItemList != null)
|
||||
{
|
||||
@if (AllowSearch == "True")
|
||||
@if (!string.IsNullOrEmpty(SearchProperties))
|
||||
{
|
||||
<div class="input-group my-3">
|
||||
<input id="search" class="form-control" placeholder=@string.Format(Localizer["SearchPlaceholder"], SearchProperties) @bind="@_search" />
|
||||
|
@ -234,9 +234,6 @@
|
|||
[Parameter]
|
||||
public Action<int> OnPageChange { get; set; } // a method to be executed in the calling component when the page changes
|
||||
|
||||
[Parameter]
|
||||
public string AllowSearch { get; set; } // allow user to search items
|
||||
|
||||
[Parameter]
|
||||
public string SearchProperties { get; set; } // comma delimited list of property names to include in search
|
||||
|
||||
|
@ -249,8 +246,6 @@
|
|||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
AllItems = Items;
|
||||
|
||||
if (string.IsNullOrEmpty(Format))
|
||||
{
|
||||
Format = "Table";
|
||||
|
@ -297,9 +292,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(AllowSearch) || string.IsNullOrEmpty(SearchProperties))
|
||||
if (!string.IsNullOrEmpty(SearchProperties))
|
||||
{
|
||||
AllowSearch = "False";
|
||||
AllItems = Items; // only used in search
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(PageSize))
|
||||
|
|
Loading…
Reference in New Issue
Block a user