cancel
Showing results for 
Search instead for 
Did you mean: 

Personas - Drop Down List Sorting

former_member204457
Active Participant
0 Kudos
277

Hi Experts,

My question is in regard to sorting of Drop-down list, we're on SP14.

I use a RFC call and populate the list which works fine. However, I've a issue with sorting the list. When the user clicks on the list, it shows the last entry in the list which is a blank line, basically the list scrolls to the bottom because that's where the blank line resides.

I saw this posting in regard to blank value in the list

Personas - Any way to remove blank entry in Drop-Down List?

My question is this: Is there anyway that I can sort the list and show the blank line at the top of the list so when the user click on the drop down it doesn't scroll to the bottom?

Thank you.

View Entire Topic
kmagons
Product and Topic Expert
Product and Topic Expert

Good day, Cyrus!

There is no officially supported way that enables you to change the position of the last, blank ComboBox key. Technically, it is possible to change the position of the blank entry by directly manipulating the SAPUI5 control via script in Slipstream Engine, however, I cannot recommend doing it as that could lead to all kinds of unexpected problems.

Your concern regarding the ComboBox control user experience problems is noted and registered for future scope planning.

Thank you very much!

Best regards,

Krists Magons

SAP Screen Personas Dev Team

PS. Here would be an example of an onAfterRefresh script in Slipstream Engine that technically moves the last element to the front of the list. Use it strictly at your own risk 🙂

/* globals setTimeout, sap */

var sComboBoxId = "wnd[0]/usr/cmbGV_LISTBOX";
var oScreenService = sap.ui.getCore().getComponent("sap.se.ui").getService("ScreenService");
var oSAPUI5ComboBox, oSAPUI5LastItem, iLength;

setTimeout( () => {
    oSAPUI5ComboBox = oScreenService.getControlById(sComboBoxId);
    if(!oSAPUI5ComboBox || oSAPUI5ComboBox.getItemAt(0).getKey() ===  ""){
        return;
    }
    iLength = oSAPUI5ComboBox.getItems().length;
    if(iLength){
        oSAPUI5LastItem = oSAPUI5ComboBox.removeItem( iLength - 1 );
        oSAPUI5ComboBox.insertItem(oSAPUI5LastItem, 0);    
    }
}, 0);