Cannot get cascading dropdowns using webapi adapter to work

I have two cascading dropdowns:

                                            <div class="row">
                                                <div class="col-sm-4">
                                                    Detector Manufacturer<span class="mandatory">*</span>
                                                </div>
                                                <div class="col-sm-8">
                                                    <SfDropDownList @ref="drpdwnDetectMan" TValue="int?" TItem="LookupDetectorManufacturers" Placeholder="Detector Manufacturer" @bind-Value="@DetectManValue">
                                                        <SfDataManager Url="api/DetectorManufacturersDD" Adaptor="Adaptors.WebApiAdaptor" CrossDomain="true"></SfDataManager>
                                                        <DropDownListFieldSettings Text="Manufacturer" Value="Id"></DropDownListFieldSettings>
                                                        <DropDownListEvents TItem="LookupDetectorManufacturers" TValue="int?" ValueChange="ChangeDetectorManufacturer"></DropDownListEvents>
                                                    </SfDropDownList>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-sm-4">
                                                    Detector Model<span class="mandatory">*</span>
                                                </div>
                                                <div class="col-sm-8">
                                                    <SfDropDownList @ref="drpdwnDetModel" Enabled="@EnableManDetModelDropDown" TValue="int?" @bind-Value="@DetModelValue" TItem="LookupDetectorModels" Placeholder="Detector Model" Query="@ManModelQuery">
                                                        <SfDataManager Url="api/DetectorModelsDD" Adaptor="Adaptors.WebApiAdaptor" CrossDomain="true"></SfDataManager>
                                                        <DropDownListFieldSettings Text="Model" Value="Id"></DropDownListFieldSettings>
                                                    </SfDropDownList>
                                                </div>
                                            </div>

I am using entity framework for talking to my database using the techniques to create a Data Access Layer here: https://blazor.syncfusion.com/documentation/dropdown-list/data-source/ 

The second (dependant) dropdown always shows no data.  The data controller is being run and is returning data I would expect.  This is confirmed by running with breakpoints and whilst using breakpoints extracting the submitted query strings and confirming that call returns the correct JSON e.g. 

{"items":[{"id":21,"manufacturerId":7,"model":"Bat4","verified":null,"manufacturer":null},{"id":22,"manufacturerId":7,"model":"Bat5","verified":null,"manufacturer":null}],"count":2}

If I ensure in the second dropdown that EnableManDetModelDropDown is always true and I remove the query parameter then the second drop down fills with data whch suggests togeather with the evidence above that the JSON is in the correct form for the dropdown.

These dropdowns are in a SfTab in another SfTab itself in a Blazor component.  That component is being rendered in a SFDialog.

4 Replies 1 reply marked as answer

JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team April 26, 2021 04:46 PM UTC

Hi Martin, 

Thanks for contacting Syncfusion support. 

We are currently checking your issue. We will update the further details in two business days(28th April 2021). 

We appreciate your patience until then. 

Thanks, 
Jeyanth. 



JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team April 29, 2021 01:10 PM UTC

Hi Martin, 

Thanks for the patience. 

We validated the reported query. Cascading dropdownlist functionality can be achieved by modifying query for the dependent dropdownlist. In addition, we need to handle the data in the server side based on the modified query. For instance,there are two dropdownlists and the first dropdownlist shows date value respect to order id and the second dropdownlist shows the freight number based on the selected date. In the ValueChange event of dropdownlist, we modified the query such that the order id should match with the changed value.


 
public void ChangeCountry(Syncfusion.Blazor.DropDowns.ChangeEventArgs<stringOrder> args) 
    { 
        this.Query = new Query().Where(new WhereFilter() { Field = "CustomerID", Operator = "equal", value = args.Value, IgnoreCase = false, IgnoreAccent = false }).RequiresCount(); 
    } 


We need to modify the data in the server based on the received query and should return the modified data.


 
switch (filterfield) 
            // filterfield is CustomerId and filtervalue is changed value of first Dropdownlist 
                { 
                    case "CustomerID": 
                        data = data.Where((a) => a.CustomerID.Equals(filtervalue)); 
                        break; 
                } 


Screenshot       

 


We made sample for your convenience. Please find the sample in the below link. 


Please let us know if you would require any further assistance on this. 

Regards, 
Jeyanth. 


Marked as answer

MA Martin May 7, 2021 12:59 PM UTC

Thanks for your reply:  I didn't seem to get an email saying the query had been updated hence the delay in my response.

I should have said that I did have the filter in the onchange event and the Where clause in the server.  Using break points it seems like the correct data is being returned by the server.  It seems like the data is not  rebinding to the child dropdown after update using the filter.


BC Berly Christopher Syncfusion Team May 10, 2021 12:51 PM UTC

Hi Martin, 
  
Please share any issue reproducing sample or modify the attached sample with the reported issue that will help us to check and proceed further from our end since the reported issue is does not occurred at our end. 
  
  
Regards, 
Berly B.C 


Loader.
Up arrow icon