cancel
Showing results for 
Search instead for 
Did you mean: 

Remove duplicates from ComboBox

askode
Explorer
0 Kudos

Hello Everyone,

i am quite new to SAPUI5 and have requirement to remove all duplicates from Combo-box binded to OData Model . i have no idea how to get it done i tried some tricks but didn't work. if you guys can give me some idea on that would be great help


Accepted Solutions (0)

Answers (3)

Answers (3)

former_member251534
Participant

Can you check if duplicate data is coming from backend . If yes , you can remove duplicates at back end and send the unique values.

Check if you add sy-langu check at backend where select query is written

Also , there might be case where key is unique but description is same for 2 keys and it appears as duplicate

former_member553417
Participant
0 Kudos

Hi Ashok ,

You can remove unique values using javascript

JS Bin Lin.

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Ashok,

Before binding the value(setProperty) to the combo box, run the forloop and using indexOf function check whether existing entries are available like below.

for(var i=0; i<country.length; i++) {
 if(a.indexOf(country[i].Country) === -1) {
    a.push(country[i].Country);
  }
}

Please find the link below

http://jsbin.com/gadaqejeze/edit?html,js,output

Regards

Rajkumar Narasimman