/// <summary> /// Read Graph Node Logic /// </summary> /// <param name="args"></param> /// <returns></returns> private async Task OnReadAsync(ComboBoxReadEventArgs args) { if (!SkipOnRead) { _searchCancellationTokenSource.Cancel(false); _searchCancellationTokenSource.Dispose(); _searchCancellationTokenSource = new CancellationTokenSource(); var oDataQuery = "$top=10&$skip=0&"; var delay = 0; if (args?.Request.Filters.Count > 0) // there is user filter input, skips providing data on initialization { oDataQuery = $"{oDataQuery}&{args.Request.ToODataString()}"; delay = 500; } await Task.Delay(delay, _searchCancellationTokenSource.Token); var response = await HttpClient.GetAsync($"odata/v1/WeatherForecastOData?{oDataQuery}"); var jsonString = await response.Content.ReadAsStringAsync(); var result = jsonString.TryParseJson <ODataResponse <BlazorGrid.Shared.WeatherForecast> >(); _weatherForecasts = result.Result.Dtos; } else { SkipOnRead = false; } }
public async Task ReadItems(ComboBoxReadEventArgs args) { string userInput = null; if (args.Request.Filters.Count > 0) { var filter = args.Request.Filters[0] as FilterDescriptor; string tempUserInput = filter.Value.ToString(); if (!string.IsNullOrWhiteSpace(tempUserInput) && tempUserInput.Trim().Length >= 3) { userInput = tempUserInput; } } if (userInput != null) { var response = await DataService.GetAsync <EmployeeSummaryVM[]>("Employee/Search", args.Request); Suggestions = response.Data; } else { Suggestions = new List <EmployeeSummaryVM>(); } }