При поиске и меньше 10 записей существует, таблица выглядит меньше:
Я попробовал атрибут. размер. Это сделало бы визуальное выглядение намного лучше.
Редактировать:
Вот базовый фрагмент кода в соответствии с запросом. />https://try.mudblazor.com/snippet/wogeugyimqawoahb
Здесь определение таблицы (как компонент бритвы):
Код: Выделить всё
Countries
No data to display
Country Name
@context.CountryName
@code {
public class CountriesDetail
{
public string ID { get; set; } = string.Empty;
public string CountryName { get; set; } = string.Empty;
}
private List data = new();
private string searchString = string.Empty;
protected override void OnInitialized()
{
data.Add(new() { ID = "1", CountryName = "Country 1" });
data.Add(new() { ID = "2", CountryName = "Country 2" });
data.Add(new() { ID = "3", CountryName = "Country 3" });
data.Add(new() { ID = "4", CountryName = "Country 4" });
data.Add(new() { ID = "5", CountryName = "Country 5" });
data.Add(new() { ID = "6", CountryName = "Country 6" });
data.Add(new() { ID = "7", CountryName = "Country 7" });
data.Add(new() { ID = "8", CountryName = "Country 8" });
data.Add(new() { ID = "9", CountryName = "Country 9" });
data.Add(new() { ID = "10", CountryName = "Country 10" });
data.Add(new() { ID = "11", CountryName = "Country 11" });
data.Add(new() { ID = "12", CountryName = "Country 12" });
}
private bool SearchFunction(CountriesDetail element) => PerformSearch(element, searchString);
private bool PerformSearch(CountriesDetail element, string searchString)
{
if (string.IsNullOrWhiteSpace(searchString)) return true;
if (element.CountryName.Contains(searchString, StringComparison.OrdinalIgnoreCase)) return true;
return false;
}
}
< /code>
Вот диалог: < /p>
Country Search
< /code>
А вот как его вызывают: < /p>
@inject IDialogService DialogService
Go
@code{
private void LoadDialog()
{
var options = new DialogOptions { CloseOnEscapeKey = true };
DialogService.Show("", options);
}
}
Подробнее здесь: https://stackoverflow.com/questions/779 ... ble-height
Мобильная версия