File tree Expand file tree Collapse file tree
src/components/BootstrapBlazor.Region/Components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- // Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
1+ // Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33// Website: https://www.blazor.zone or https://argozhang.github.io/
44
@@ -55,6 +55,7 @@ public partial class SelectCity
5555
5656 private readonly HashSet < string > _values = [ ] ;
5757 private string ? _searchText ;
58+ private bool _showSearch ;
5859
5960 private string ? GetActiveClass ( string item ) => CssBuilder . Default ( )
6061 . AddClass ( "active" , _values . Contains ( item ) && IsMultiple )
@@ -75,6 +76,32 @@ protected override void OnParametersSet()
7576 {
7677 _values . Clear ( ) ;
7778 }
79+
80+ if ( ShowSearch == false )
81+ {
82+ _searchText = "" ;
83+ }
84+ }
85+
86+ /// <summary>
87+ /// <inheritdoc/>
88+ /// </summary>
89+ /// <param name="firstRender"></param>
90+ /// <returns></returns>
91+ protected override async Task OnAfterRenderAsync ( bool firstRender )
92+ {
93+ await base . OnAfterRenderAsync ( firstRender ) ;
94+
95+ if ( firstRender )
96+ {
97+ _showSearch = ShowSearch ;
98+ }
99+
100+ if ( ! _showSearch != ShowSearch )
101+ {
102+ _showSearch = ShowSearch ;
103+ await InvokeVoidAsync ( "resetSearch" , Id , ShowSearch ) ;
104+ }
78105 }
79106
80107 /// <summary>
You can’t perform that action at this time.
0 commit comments