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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Refresh e-data-manager data

Thread ID:

Created:

Updated:

Platform:

Replies:

145066 Jun 4,2019 08:53 PM UTC Jun 18,2019 01:53 PM UTC ASP.NET Core - EJ 2 3
loading
Tags: ComboBox
Bernard Jurlina
Asked On June 4, 2019 08:53 PM UTC

I have my combobox like this:

<ejs-combobox id="UlicaId" ejs-for="@Model.UlicaId" popupHeight="220px">
                            <e-data-manager adaptor="UrlAdaptor" url="Maticni/Firmas/DSUlica" crossDomain="true"></e-data-manager>
                            <e-combobox-fields text="Naziv" value="UlicaId"></e-combobox-fields>
                        </ejs-combobox>

public ActionResult DSUlica([FromBody]Ulica dm)
        {
            var dsUlica = from u in _context.Ulica
                          orderby u.Naziv
                          select new
                          {
                              u.UlicaId,
                              u.Naziv
                          };
            var Data = dsUlica.ToList();
            return Json(Data);
        } 

which gives me this:




So, the data binding is ok, in the edit view ejs-for is working fine.
But, with this blue button I'm opening the dialog for the streets. Ulica means street in croatian. 



And then I can add the new one:



And it's in the database right now:



But when I close the dialog and open the combobox dropdown again, there is no street named XXXXXXX.



So, I want to refresh the combobox data after closing the dialog, or on beforeOpen event maybe.

Is there some help for that?

Thanks.
Bernard.

Karthik Ravichandran [Syncfusion]
Replied On June 5, 2019 11:24 AM UTC

Hi Bernard, 

Thanks for contacting Syncfusion support. 

We have checked your query base on your shared data’s. We suspect that, reported issue may rises due to below possible reason. 

  • While adding the new field to the Combobox, you may add the details to your application database only. So datasource mapped with Combobox may not be updated with latest data.
  • So we suggested you to keep the data’s in application database and Combobox datasource same.  i.e Add the new field to Combobox datasource also along with your DB.

If you are still facing the same issue, please share the datas present in your Combobox data source and application data base. So it will help us to provide the solution at earliest. 

Regards, 
Karthik R 


Bernard Jurlina
Replied On June 17, 2019 08:12 PM UTC

Hi Karthik!

Yes, I know that the data in the combobox is not like the data in the database. I wanted to ask about the option to refresh combobox data in the beforeOpen event of the combobox...or refresh the combobox data in any other way if it's bounded with UrlAdaptor.

Thanks.
Bernard.

Prince Oliver [Syncfusion]
Replied On June 18, 2019 01:53 PM UTC

Hi Bernard, 

Good day to you. 

When adding a new item to the database, we suggest you add this item to the ComboBox’s dataSource property. Kindly refer to the following code. 

var data = ddCountryData; // copying the datasource to a variable 
data.push({ Name: 'New State', Code: 'GS' }); // Pushing the newly added item to the duplicated datasource 
comboBoxObj.dataSource = data; // binding it to the dataSource property 
comboBoxObj.dataBind(); // Calling dataBind method to update the changes to the control immediately 

You can use the above steps in the beforeOpen or focus events too, once the data the updated in the database. Kindly check the above solution and let us know if you need any further assistance. 

Regards, 
Prince  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon