Pre-selected values can not be deleted

I am using autocomplete on an editing screen and placing the pre-selected values ​​using the 'value' property of the automplete. However, it is not possible to delete any pre-selected element. What am I missing?

let mainCities = [{"id":"3500105","nome":"Adamantina"},{"id":"3500204","nome":"Adolfo"}];
var listObj = new ej.dropdowns.MultiSelect({
dataSource: cities,
popupHeight: '200px',
popupWidth: '250px',
fields: { text: 'nome', value: 'id' },
allowFiltering: true,
placeholder: "Selecione as cidades...",
value: mainCities
});
listObj.appendTo('#seleciona');

3 Replies 1 reply marked as answer

BC Berly Christopher Syncfusion Team January 25, 2021 10:22 AM UTC

Hi Anselmo, 
  
Greetings from Syncfusion support. 
  
While checking the provided code example, you have bind the value property as the complex array in the MultiSelect component. But, we can provide string[], int[] and Boolean[] for the value property in the MultiSelect component. This may the cause of the reported issue. So, we suggest you to assign the value to the component based on available types. 
  
  
  var listObj = new ej.dropdowns.MultiSelect({ 
  dataSource: cities, 
  popupHeight: "200px", 
  popupWidth: "250px", 
  fields: { text: "nome", value: "id" }, 
  allowFiltering: true, 
  placeholder: "Selecione as cidades...", 
  value: ["3500105"] 
    }); 
    listObj.appendTo("#local"); 

  
  
Regards, 
Berly B.C 


Marked as answer

AM Anselmo Marthins de January 25, 2021 02:31 PM UTC

Hi Berly, thanks for your support!

I got your code as a reference and realized that the problem was in the cities array. I changed the 'id' field to string and it worked perfectly!
Thank you once again,

Regards

Anselmo Marthins


BC Berly Christopher Syncfusion Team January 26, 2021 05:19 AM UTC

Hi Anselmo, 
  
We are glad to know that your issue is resolved. Please let us know if you need further assistance on this. 
  
Regards, 
Berly B.C 


Loader.
Up arrow icon