Skip to Content
0

Remove duplicates from ComboBox

May 07 at 01:20 AM

49

avatar image

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


combo.png (21.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

tisha dharod May 07 at 07:51 AM
2

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

Share
10 |10000 characters needed characters left characters exceeded
Drushya S May 07 at 06:23 AM
0

Hi Ashok ,

You can remove unique values using javascript

JS Bin Lin.

Share
10 |10000 characters needed characters left characters exceeded
Rajkumar Narasimman May 07 at 06:16 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded