Issue setting default value of 2nd dropdownlist in cascading dropdowns

I have 2 dropdownlists: One for a Vertical Market & a 2nd dependent one for Vertical Market Subsegment.  I'm trying to add feature where if there is only value in the 2nd list, it automatically selects that value. Is this possible?  In my code below, if I initially select a Vertical Market with only 1 subsegment, it works correctly.  But then if I select a different Vertical Market with more than one subsegment, I get the following error: Error: System.AggregateException: One or more errors occurred. (TypeError: Cannot read property 'removeChild' of null)
 ---> System.InvalidOperationException: TypeError: Cannot read property 'removeChild' of null



In my code:

void UpdateSubsegments(string val)
    {
        isVMSubsegmentEnabled = true;
        subsegmentList = allSubsegments.Where(x => x.vertical_market == val).ToList();

        if (subsegmentList.Count == 1)
        {
            projectParameters.VerticalMarketSubsegment = subsegmentList.Select(y => y.name).First();
        }
        else
        {
            projectParameters.VerticalMarketSubsegment = null;
        }
    }

private void VerticalMarketChanged(Syncfusion.EJ2.Blazor.DropDowns.ChangeEventArgs args)
    {
        UpdateSubsegments(args.Value);
    }


5 Replies

SP Sureshkumar P Syncfusion Team March 11, 2020 01:41 PM UTC

Hi Katie, 
 
Greetings from Syncfusion support. 
 
Based on your shared information with error details, we suspect that you have referred the different version of ej2.min.js and ejs.interop.min.js files compare with your installed NuGet version. We suggest you refer the same version script files to resolve the facing issue. 
 
Installed NuGet version is: 17.4.0.55 then please use the script file as same version like below. 
 
Scripts: 
 
Regards, 
Sureshkumar P 



KP Katie Prodoehl March 11, 2020 03:34 PM UTC

I just made sure they all matched up with latest version & still getting same error.


SP Sureshkumar P Syncfusion Team March 12, 2020 11:33 AM UTC

Hi Katie, 
 
Thanks for your update.  
 
We have created the dropdownlist sample with cascading feature. Please check the sample. We were unable to replicate the reported issue from our end. 
 
 
If still you have facing the issue from your end, please replicate the issue in our attached sample and revert the sample with detailed issue replication procedure. That will help us to provide exact solution at earliest. 
 
Regards, 
Sureshkumar P 



KP Katie Prodoehl March 12, 2020 06:02 PM UTC

I've attached sample generating error.  I added Mexico as a country with only one state.  Here are steps to replicate error:

1. Country -> Choose Mexico; State auto becomes Mexico (desired result)
2. Country -> Choose United States; State -> Choose New York
3. Country -> Choose Mexico... error: Uncaught (in promise) TypeError: Cannot read property 'insertBefore' of null

Attachment: DDL__Copy_f83d36e9.zip


SP Sureshkumar P Syncfusion Team March 13, 2020 12:33 PM UTC

Hi Katie, 
 
Thanks for sharing the information. 
 
We can replicate your reported issue, and we confirmed this as a bug in our end. This fix will be included in our upcoming volume-1 2020 release. Which is expected to roll out end of March 2020. We appreciate your patience until then. You can track the status of the bug in the below feedback link. 
 
 
Regards, 
Sureshkumar P  


Loader.
Up arrow icon