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

Change of dataSource second time causes problems

Hello,
  I'm having a problem with ejs-combobox. When I try to update the data element that's being used as the dataSource in the control (for the second time) the control does not behave as expected - the list reduces to just 1 element.
  If nothing is selected in the combobox the items are successfully refreshed. However, if an item is selected only that item remains in the list after this code is run.
See attached file for ejs-combobox projectFilter.
Thanks,
Lee

Attachment: Timesheets_870fb483.zip

4 Replies

SN Sevvandhi Nagulan Syncfusion Team January 12, 2020 07:38 AM UTC

Hi LEE, 

Greetings from Syncfusion support. 

We have checked the shared sample. Due to the dependency problem we could not able to run the sample. So we have prepared the simple sample by changing the datasource in the button click. Please check the sample, 


Is still issue persists , kindly revert us below details that help us to proceed further. 

  1. Full runnable sample
  2. Package.json

Regards, 
Sevvandhi N 



LJ LEE J WEINER January 13, 2020 06:30 PM UTC

Hello,
  I modified your sample to use my app's combobox properties, and added a second button and method to set the datasource. 
  This behaves as my original did. When you click a button for the first time, the combobox populates correctly. However, clicking on the other button leaves just the 'None' entry and none of the sports listed. To replicate this behavior:

Click first Refresh button - note that dropdown is correct
Click second Refresh button - note that only "None" is in dropdown
Click first Refresh button - note that only "None" is in dropdown

Thanks,
Lee 

Attachment: Sample_bed260f9.zip


SN Sevvandhi Nagulan Syncfusion Team January 15, 2020 03:33 AM UTC

Hi LEE, 
 
We have checked your query and can able to reproduce the reported issue. Since you have given same Id for both datasource and you have enabled filtering, while updating the value property, filtering happens and the same value is set for both the cases . So we suggest you to call dataBind() method to reflect the value instantly. Please refer the below code snippet and get back to us if you need any further assist on this. 

refreshDataSource2: function() { 
var sportsData = [ 
{ Id: "-1", Game: "None" }, 
{ Id: "GameB", Game: "Baseball" }, 
{ Id: "GameS", Game: "Soccer" }, 
{ Id: "GameH", Game: "Hockey" } 
] 
this.$refs.comboboxObj.ej2Instances.value = null; 
this.$refs.comboboxObj.ej2Instances.dataBind(); 
this.$refs.comboboxObj.ej2Instances.dataSource = sportsData; 
this.$refs.comboboxObj.ej2Instances.value = '-1'; 
this.$refs.comboboxObj.ej2Instances.dataBind(); 
} 
  

Regards, 
Sevvandhi N 
   



LJ LEE J WEINER January 15, 2020 05:45 AM UTC

Great...that seems to resolve the issue.

Thanks for the help & you can close this one.

-Lee

Loader.
Live Chat Icon For mobile
Up arrow icon