Skip to content

Commit af17b37

Browse files
committed
feat(Table): add AutoSearchOnValueChanged parameter
1 parent b6272ee commit af17b37

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/BootstrapBlazor/Components/Table/Table.razor.Search.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,16 @@ protected List<IFilterAction> GetAdvanceSearches()
314314
/// </summary>
315315
protected List<IFilterAction> GetSearches() => Columns.Where(col => col.GetSearchable()).ToSearches(SearchText);
316316

317+
private async Task OnSearchTextValueChanged(string? value)
318+
{
319+
SearchText = value;
320+
321+
if (AutoSearchOnValueChanged)
322+
{
323+
await SearchClick();
324+
}
325+
}
326+
317327
/// <summary>
318328
/// <para lang="zh">点击重置搜索按钮时调用此方法</para>
319329
/// <para lang="en">Method called when the reset search button is clicked</para>

src/BootstrapBlazor/Components/Table/Table.razor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ public partial class Table<TItem> : ITable, IModelEqualityComparer<TItem> where
2424
[Parameter]
2525
public bool AutoSearchOnInput { get; set; }
2626

27+
/// <summary>
28+
/// <para lang="zh">获得/设置 模糊搜索栏文本更新后是否自动搜索 默认值 false</para>
29+
/// <para lang="en">Gets or sets whether to auto search when fuzzy search bar value changed. Default false</para>
30+
/// </summary>
31+
[Parameter]
32+
public bool AutoSearchOnValueChanged { get; set; }
33+
2734
/// <summary>
2835
/// <para lang="zh">获得/设置 不支持过滤类型提示信息 默认 null 读取资源文件内容</para>
2936
/// <para lang="en">Gets or sets Not Supported Column Filter Message. Default null (Read from resource file)</para>

0 commit comments

Comments
 (0)