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

Refresh e-data-manager data

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.

3 Replies

KR Karthik Ravichandran Syncfusion Team 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 



BJ Bernard Jurlina 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.


PO Prince Oliver Syncfusion Team 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  


Loader.
Live Chat Icon For mobile
Up arrow icon