We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Problem with addItem.

Hi guys,

I'm having a problem adding an item to the dropdownlist, the situation is as follows:

I have the following component in my app:

<ejs-dropdownlist id="GroupCode" placeholder="@localizer["SelectGroup"]" query="@query" allowFiltering="true" >

                         <e-data-manager adaptor="UrlAdaptor" url=@Url.Action("GetGroups","Administration") crossDomain="true" offline="true"></e-data-manager>

                         <e-dropdownlist-fields value="GroupCode"></e-dropdownlist-fields>

</ejs-dropdownlist>

I then want to add an item using oF.sfControls.GroupCode.addItem(myObject)

It seems that the datasource is not ready to add new objects and I get the following error:

"Uncaught TypeError: Cannot read properties of undefined (reading 'push') at t.addItem"

How can I solve this situation?

Thanks!


1 Reply

UD UdhayaKumar Duraisamy Syncfusion Team October 26, 2022 08:52 AM

Hi Fercap,


We suggest you refer to the below syncfusion documentation for your requirement,

https://ej2.syncfusion.com/aspnetcore/documentation/drop-down-list/how-to/add-item?cs-save-lang=1&cs-lang=razor


Kindly try the above sample and let us know if this meets your requirement. If we misunderstood the requirement, we request you to provide additional details about the requirement as mentioned below. This will help us validate the requirement further and provide you with a better solution.

  1. Exact Requirement details.

  2. Please share a simple issue replicating runnable sample.

  3. Video illustration of the issue.


Regards,

Udhaya Kumar D


Loader.
Live Chat Icon For mobile
Up arrow icon