43 lines
1.2 KiB
Plaintext
43 lines
1.2 KiB
Plaintext
@using MP.Prog.Components
|
|
@using MP.Prog.Data
|
|
@using Majorsoft.Blazor.Components.Debounce
|
|
|
|
@inject MessageService MessageService
|
|
|
|
<div class="input-group input-group-sm">
|
|
<DebounceInput id="sVal" class="form-control" placeholder="@("Ricerca (min " + _minChar + " char)")" autocomplete="off" @ref="debInput" @bind-Value="@_searchVal" @bind-Value:event="OnInput" DebounceTime="@_debMsec" MinLength="@_minChar" OnValueChanged="e => { searchVal = e; }" ForceNotifyByEnter="true" ForceNotifyOnBlur="true" />
|
|
|
|
<div class="input-group-append">
|
|
<button @onclick="reset" class="btn btn-success input-group-text">reset</button>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
private string _searchVal = "";
|
|
private int _debMsec = 200;
|
|
private int _minChar = 2;
|
|
private DebounceInput debInput;
|
|
|
|
[Parameter]
|
|
public string searchVal
|
|
{
|
|
get
|
|
{
|
|
return MessageService.SearchVal;
|
|
}
|
|
set
|
|
{
|
|
if (!MessageService.SearchVal.Equals(value))
|
|
{
|
|
MessageService.SearchVal = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void reset()
|
|
{
|
|
_searchVal = "";
|
|
searchVal = "";
|
|
}
|
|
|
|
} |