Skip to Content

Remove duplicates from ComboBox

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • May 07 at 07:51 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • May 07 at 06:23 AM

    Hi Ashok ,

    You can remove unique values using javascript

    JS Bin Lin.

    Add comment
    10|10000 characters needed characters exceeded

  • May 07 at 06:16 AM

    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

    Add comment
    10|10000 characters needed characters exceeded