Tested version
BlazorBlueprint.Components 3.15.0
Description
According to the Data Grid documentation (https://blazorblueprintui.com/docs/components/data-grid), enabling ShowSearch should provide a debounced global search input. However, the search callback is only triggered when the input loses focus or when the user presses Enter.
Typing text and waiting for the debounce interval does not invoke the search or refresh an ItemsProvider. Clearing the input also does not reload the full dataset until Enter is pressed or the input loses focus.
This behavior is also reproducible on documentation DataGrid documentation section Global Search.
Minimal reproduction
<BbDataGrid TData="Account"
ItemsProvider="LoadAccounts"
ShowSearch="true"
SearchDebounceMs="300">
<Columns>
<BbDataGridPropertyColumn Property="@(x => x.Name)"
Filterable="true" />
</Columns>
</BbDataGrid>
private async ValueTask<DataGridResult<Account>> LoadAccounts(DataGridRequest request)
{
Console.WriteLine(request.SearchText);
// Load data using request.SearchText
...
}
Steps to reproduce
- Create a BbDataGrid with ShowSearch="true".
- Use an ItemsProvider.
- Type a search term.
- Stop typing and wait longer than SearchDebounceMs.
- Observe that the provider is not called with the new search text.
- Press Enter or move focus away from the input.
- Observe that the search is then triggered.
Expected behavior
SearchTextChanged and/or ItemsProvider should be invoked automatically after the configured debounce interval, without requiring Enter or blur.
Clearing the input should also trigger a debounced refresh with an empty or null search value.
Actual behavior
The search input behaves like an OnChange input:
- no callback while typing;
- no callback after the debounce interval;
- callback only on blur or Enter.
Possible cause
BbDataGrid internally renders the search input approximately as:
<BbInput Value="@(_searchInputValue ?? SearchText)"
ValueChanged="@HandleSearchInput"
Placeholder="..." />
BbInput defaults to UpdateTiming.OnChange. The HandleSearchInput method then implements its own debounce using Task.Delay, but it never receives per-keystroke updates, so the debounce cannot start until blur or Enter.
The internal input may need to explicitly use:
<BbInput Value="@(_searchInputValue ?? SearchText)"
ValueChanged="@HandleSearchInput"
UpdateTiming="UpdateTiming.Immediate"
... />
This would allow HandleSearchInput to perform the documented debounce correctly.
Workaround currently used
Applications can hide the built-in search and provide their own debounced BbInput, then call the grid’s public RefreshDataAsync() method after the debounced value changes. This works, but it defeats the purpose of the documented ShowSearch and SearchDebounceMs API.
(written with help of AI)
Tested version
BlazorBlueprint.Components 3.15.0
Description
According to the Data Grid documentation (https://blazorblueprintui.com/docs/components/data-grid), enabling ShowSearch should provide a debounced global search input. However, the search callback is only triggered when the input loses focus or when the user presses Enter.
Typing text and waiting for the debounce interval does not invoke the search or refresh an ItemsProvider. Clearing the input also does not reload the full dataset until Enter is pressed or the input loses focus.
This behavior is also reproducible on documentation DataGrid documentation section Global Search.
Minimal reproduction
Steps to reproduce
Expected behavior
SearchTextChanged and/or ItemsProvider should be invoked automatically after the configured debounce interval, without requiring Enter or blur.
Clearing the input should also trigger a debounced refresh with an empty or null search value.
Actual behavior
The search input behaves like an OnChange input:
Possible cause
BbDataGridinternally renders the search input approximately as:BbInputdefaults toUpdateTiming.OnChange. TheHandleSearchInputmethod then implements its own debounce usingTask.Delay, but it never receives per-keystroke updates, so the debounce cannot start until blur or Enter.The internal input may need to explicitly use:
This would allow
HandleSearchInputto perform the documented debounce correctly.Workaround currently used
Applications can hide the built-in search and provide their own debounced
BbInput, then call the grid’s publicRefreshDataAsync()method after the debounced value changes. This works, but it defeats the purpose of the documentedShowSearchandSearchDebounceMsAPI.(written with help of AI)