Objective:
I'm trying to have a RadzenDropDown cascade to a RazenDropDownDataGrid (with multiple select true) - I'm following the " Cascading DropDowns" example but have changed the type of controls.
Issue:
The RadzenDropDown loads correctly and works as expected - however, the RazdenDropDownDatagrid will not load the filtered data until I click on the dropdown and click sort, then my filtered data will show.
Question:
I can't figure out a way to force the data to load or reload without clicking on sort first, what should I try or what can I do to force the data to reload the RazdenDropdowndatagrid when the RadzenDropdown item changes - this works when I cascade from RadzenDropDown to RadzenDropDown (single select)
MODELS:
public class ViewDealer
{
public int? Dealerid { get; set; }
public string Dealername { get; set; }
}
public class ViewDealerlocation
{
public int? Dealerlocationid { get; set; }
public string Delaerlocationname { get; set; }
public int? Dealerlocationparentid { get; set; }
public int? Dealerlocationpartnerid { get; set; }
}
CONTROLS:
Dealers
<RadzenDropDown TValue="int" @bind-Value="iDealerid" Placeholder="Select Dealer" AllowFiltering="true"
Data="@(Dealers)" TextProperty="Dealername" ValueProperty="Dealerid" Style="margin-bottom: 20px"
LoadData="@(args => LoadData(args))"
Change="@(args => Change(args, "DropDownDataGridDealers"))"/>
Locations
<RadzenDropDownDataGrid AllowFiltering="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" AllowClear="true"
@bind-Value="multipleValues" Multiple="true" Placeholder="Select Location..." LoadData="@(args => LoadData(args))"
Data="@(Locations.Where(l => l.Dealerlocationparentid == iDealerid))" s TextProperty="Delaerlocationname" ValueProperty="Dealerlocationparentid"
Change="@(args => Change(args, "DropDownDataGridLocations"))" Style="width:400px;" />
CODE:
IEnumerable<ViewDealer> Dealers; IEnumerable<ViewDealerlocation> Locations; IEnumerable<int> multipleValues; int iDealerid; int iDealerlocationid;
void Change(object value, string name)
{
var str = value is IEnumerable<object> ? string.Join(", ", (IEnumerable<object>)value) : value;
Locations = Locations.Where(l => l.Dealerlocationparentid == iDealerid);
StateHasChanged();
InvokeAsync(StateHasChanged);
}
void LoadData(LoadDataArgs args)
{
Locations = Locations.Where(l => l.Dealerlocationparentid == iDealerid);
InvokeAsync(StateHasChanged);
}